ISO Mounts and best practice

ixproxmox

Active Member
Nov 25, 2015
56
0
26
Hi,

I have been "struggling" with this ever since I started using Proxmox and in the beginning I was thinking it was only a bug. But after installing it many times over the years in different versions and different file servers, it seems like this is how it is.

On vmware, on iso for IPMI-control and in most cases, you can share a nfs-mount from a file-server, like IP/iso and your files will be in /iso. Any files you upload ends up in iso and this way it is easy to share across all devices that need this. But every time on Proxmox, it creates its own structure under /iso with subfolder /template/iso (and it you refuse to let it access it, it causes all kind of issues). So need to do special things on this when I want to share iso across hosts or access it. Is there something I'm missing?
 

t.lamprecht

Proxmox Staff Member
Staff member
Jul 28, 2015
5,217
1,521
164
South Tyrol/Italy
shop.proxmox.com
Hi.

I'm not sure what the problem is, either:
  1. just re-use the SHARE:/template/iso folder (which multiple Proxmox VE can naturally do fine)
  2. create a relative link to your "real" iso storage folder at SHARE:/template/iso, for example:
    root@foo:/mnt/pve/storageid/template# ln -s ../iso/ iso
Option 2 needs to be done only once, and allows to integrate with any other folder layout, albeit links on NFS only work everywhere if the target is on the same share and a relative path is used.
 

ixproxmox

Active Member
Nov 25, 2015
56
0
26
I have this mount on smb in Windows and other places also, so that 2nd command seemed to create a unlimited tree of iso-folders (see below). Units like Qnap even have ready-made share for isos.

Other times, the iso have not been updated because of maybe connection problems or similar. So the problem is that I just would like to choose my own iso folder and have it cross-platform like vmware, windows and most other platforms do with no hassle. Sure, I could of course get used to store in subfolder, but it is just extra things to type and often there is work to be done from terminals with bad language/keyboard-support (so that / and \ is nightmare and not possible to copy/paste because of java-console).

Z:\template\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso\iso
 

t.lamprecht

Proxmox Staff Member
Staff member
Jul 28, 2015
5,217
1,521
164
South Tyrol/Italy
shop.proxmox.com
so that 2nd command seemed to create a unlimited tree of iso-folders (see below).

You probably went into the "template/iso" directory and then created ther a link named "iso" on the outer "iso" folder, i.e., created a loop... There are various tutorials and documentation about how symbolic links work, if you're not used to that concept (it comes often in as very useful).

So assuming that your desired target "iso" directory is located in the mounted share in PVE at /mnt/pve/storageid/iso and we want to create a link to it at /mnt/pve/storageid/template/iso (and cleanup your loop from previously)
Bash:
cd /mnt/pve/storageid/template
rm -rf iso   # obviously check that you operate on the correct thing before doing this
ln -s ../iso iso
 

LnxBil

Famous Member
Feb 21, 2015
6,059
740
133
Germany
On vmware, on iso for IPMI-control and in most cases, you can share a nfs-mount from a file-server, like IP/iso and your files will be in /iso. Any files you upload ends up in iso and this way it is easy to share across all devices that need this. But every time on Proxmox, it creates its own structure under /iso with subfolder /template/iso (and it you refuse to let it access it, it causes all kind of issues). So need to do special things on this when I want to share iso across hosts or access it. Is there something I'm missing?

No, you're not missing anything. This is just how it is and how PVE organizes its files. We arranged us also with it and build it PVE-centric, so the default layout with template/iso and also use it on VMware, Hyper-V and whatever other hypervisor we need. Yes, we need to switch two times into a subfolder, but normally it remembers them, so there is so real problem.
 

ixproxmox

Active Member
Nov 25, 2015
56
0
26
You probably went into the "template/iso" directory and then created ther a link named "iso" on the outer "iso" folder, i.e., created a loop... There are various tutorials and documentation about how symbolic links work, if you're not used to that concept (it comes often in as very useful).

So assuming that your desired target "iso" directory is located in the mounted share in PVE at /mnt/pve/storageid/iso and we want to create a link to it at /mnt/pve/storageid/template/iso (and cleanup your loop from previously)
Bash:
cd /mnt/pve/storageid/template
rm -rf iso   # obviously check that you operate on the correct thing before doing this
ln -s ../iso iso

Thanks. When looking at the logs in terminal, this below is what I did. I have used ln at lot, but it goes months between each time I use it ;) But it looks like it is similar to what suggested here or do I overlook something? From the logs, I have only replaced my machine-name.

cd /mnt/pve/NAMEOFMACHINE/template/
ln -s ../iso/ iso
 

t.lamprecht

Proxmox Staff Member
Staff member
Jul 28, 2015
5,217
1,521
164
South Tyrol/Italy
shop.proxmox.com
But it looks like it is similar to what suggested here or do I overlook something?

The issue in your case is that the "iso" directory already existed in "/mnt/pve/NAMEOFMACHINE/template/" and thus the symlink command did not overwrite it, as no --force was passed, but placed the symlink inside the "iso" directory. Due to being a relative symlink, but placed one level deeper then intended, it now pointed at it's parent folder and created a symlink loop.

Can you please try the command sequence below, moving the current iso folder before creating the symlink to avoid this:
Bash:
cd /mnt/pve/NAMEOFMACHINE/template
mv iso iso.old
ln -s ../iso iso
 

ixproxmox

Active Member
Nov 25, 2015
56
0
26
Code:
root@px:/mnt/pve/NAMEOFMACHINE/template# ls
iso  iso.old
root@px:/mnt/pve/NAMEOFMACHINE/template# rm -Rf iso
root@px:/mnt/pve/NAMEOFMACHINE/template# ls
iso.old
root@px1:/mnt/pve/NAMEOFMACHINE/template# ln -s ../iso iso
root@px1:/mnt/pve/NAMEOFMACHINE/template# cd iso
root@px1:/mnt/pve/NAMEOFMACHINE/template/iso# ls
iso
root@px:/mnt/pve/NAMEOFMACHINE/template/iso# cd iso/
root@px:/mnt/pve/NAMEOFMACHINE/template/iso/iso# ls
iso
root@px:/mnt/pve/NAMEOFMACHINE/template/iso/iso#
 

t.lamprecht

Proxmox Staff Member
Staff member
Jul 28, 2015
5,217
1,521
164
South Tyrol/Italy
shop.proxmox.com
OK, gosh damn it, I'm an idiot..

Please replace the ln step with: ln -s ../../iso iso

I mean, moving the old iso folder is still necessary but using the correct relative path too, sorry about that, no idea what I initially thought - especially as I locally tested it with ../../iso o_O



EDIT: ok wrong alarm, I had the correct and in mind but got tricked by our own software ...
My initial theory is correct, the issue is just because of the iso folder being still there, and even after you move it you have at max a ten second window to do the linking as else pvestatd will have already recreated the directory structure (including the "iso" directory)..
You can confirm this yourself by deleting the iso directory, then waiting around 10 seconds and doing a ls and the "iso" directory will have reapeeared.

So I assume now that you moved the old iso directory with data already - i.e., iso doesn't has any important thing in it.
With that in mind do:
rm -rf iso && ln -s ../iso iso

to narrow the race window between the auto re-creation of the directory and the link creation by you.
 
Last edited:

ixproxmox

Active Member
Nov 25, 2015
56
0
26
Thank you for trying :) But when I do this, it doesn't seem like it is a directory that is created. It seems like a file...

root@px1:/mnt/pve/.../template# ls
iso iso.old
root@px1:/mnt/pve/.../template# cd iso
-bash: cd: iso: No such file or directory

6 May 26 22:58 iso -> ../iso
 

t.lamprecht

Proxmox Staff Member
Staff member
Jul 28, 2015
5,217
1,521
164
South Tyrol/Italy
shop.proxmox.com
I mean, I'm acting really in the dark here, so it's a bit hard to give clear directions. :)

it doesn't seem like it is a directory that is created. It seems like a file...

Well, a symbolic link can point to both, file and directory, so it's actually neither.

root@px1:/mnt/pve/.../template# cd iso
-bash: cd: iso: No such file or directory

That means that the target directory the link points to doesn't exist, so your desired iso directory is probably at another path, you have to find that. The good news link creation now worked, baby steps :)

From the /mnt/pve/.../template directory you could use find ../ -type d to print out all directories on that mount, and check them for the desired target directory.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!