replace directory /var/lib/vz w symbolic link

shatter

Member
Nov 27, 2009
74
0
6
Hi *,

for some practical reason I need to replace the physical directory
/var/lib/vz

with a symolic link like
/var/lib/vz -> /container/vz

Problem is: the directory VZ is always busy, so replacement with a link is not possible:

host1:/# cd /var/lib
host1:/var/lib# mv vz vzold
mv: cannot move `vz' to `vzold': Device or resource busy
host1:/var/lib#

How can I ensure that the directory is movable resp deletable? I did shut down all pve* and the "vz" demons, but the dir was not released. So which process locks/uses it?

A lesser alternative would be to mount a Partition to /var/lib/vz ...
but for this it must be "unbusy" too ....

Kind regards,

Joachim
 
I think I found a way ... by unmounting /var/lib/vz and remounting it to the device /dev/sdb1, which contains a copy of the "old" "/var/lib/vz".

Now, if I need a different "base" directory than "/var/lib/vz", say something like "/var/lib/vz/host1/vz" ... is there any config file to be changed beyond /etc/conf/vz.conf ?

j.
 
All I wrote is bullsh*t; I just have to change /etc/vz/vz.conf - don't I?

Sorry to have bothered you all.

j.
 
[FONT=Verdana, sans-serif]Hello Dietmar,[/FONT]

[FONT=Verdana, sans-serif]
Sorry, I guess I have hardcoded that path several times. Would you mind to explain why you want to change it?

Sure.
We have an IBM Bladecenter S with three blades and an SAS storage. There is also a proxmox test server. Alle machines define a proxmox cluster.

My idea was to virtualize the current physical servers - seven linux systems and three windows boxes - and split them further into their basic functions like mailserver, tomcat server 1, tomcat server 2, oracle Server 1, 2, 3 ... and so on. We would end up with 20 containers / virtual machines.

To shorten the downtime in case of blade failure and ease the backup tasks I planned to create a „public“ LUN which contained alls the containers and VMs of all blades and mount that LUN to every blade, to the directory [FONT=Courier New, monospace]/container[/FONT]. From each blade you would see the subdirs

[FONT=Courier New, monospace]/container/blade1/vz
/container/blade2/vz
/container/blade3/vz[/FONT]
[/FONT]

[FONT=Verdana, sans-serif]below [FONT=Courier New, monospace]/container[/FONT]. [/FONT]

[FONT=Verdana, sans-serif]Now I just had to ensure that each blade worked in its own part of the „vz common“-directory: [FONT=Courier New, monospace]/container/bladeX/vz[/FONT] … or at least its „important“ files resided there.

So what I did first was to move the .[FONT=Courier New, monospace]/private[/FONT] and [FONT=Courier New, monospace]./template[/FONT] dirs to [FONT=Courier New, monospace]/container/bladeX/vz[/FONT], create fitting symlinks in
[/FONT][FONT=Verdana, sans-serif]/var/lib/vz [/FONT][FONT=Verdana, sans-serif]and then try to migrate a container from my "Old" proxmox test server.

But ... it seems that the software has problems with symbolic links; at least below [FONT=Courier New, monospace]/var/lib/vz[/FONT] ... at least one of the Perl scripts (/usr/share/perl5/PVE/Storage.pm, Line 2129f) generates an error trying to create the subdir "iso" ... which exists below the symlink ./template. Somehow the script does not recognise the symlink as a directroy.

I changed my approach to create a symbolic link one level higher: /var/lib/vz was to point to [FONT=Courier New, monospace]/container/blade1/vz[/FONT] .... BUT I never was able to move the directory VZ due to a "Device or resource busy" error so I could not create the symlink. This also made it impossible to directly mount the LUN to /var/lib/vz ...

Next approach:
Change the VZ base directory by changing the config file ...

Well ...

Kind regards,

Joachim

[/FONT]
 
Last edited:
[FONT=Verdana, sans-serif]To shorten the downtime in case of blade failure and ease the backup tasks I planned to create a „public“ LUN which contained alls the containers and VMs of all blades and mount that LUN to every blade, to the directory [FONT=Courier New, monospace]/container[/FONT]. From each blade you would see the subdirs[/FONT][FONT=Verdana, sans-serif]

[FONT=Courier New, monospace]/container/blade1/vz[/FONT]
[FONT=Courier New, monospace]/container/blade2/vz[/FONT]
[FONT=Courier New, monospace]/container/blade3/vz[/FONT][/FONT]
[FONT=Verdana, sans-serif][/FONT]

What kind of 'shared' filesystem do you use?
 
What kind of 'shared' filesystem do you use?
Actually it is a just LUN(?) of the SAS storage configured as „public“ and mounted to the directory /container on every Blade during bootup via /etc/fstab.

blade2:~# cat /etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/pve/root / ext3 errors=remount-ro 0 1
#/dev/pve/data /var/lib/vz ext3 defaults 0 1
/dev/sda1 /boot ext3 defaults 0 1
/dev/pve/swap none swap sw 0 0
proc /proc proc defaults 0 0
/dev/sdb1 /container ext3 defaults 0 1
/dev/sdc1 /oradata ext3 defaults 0 1
/dev/sdd1 /public ext3 defaults 0 1
blade2:~#
blade2:~# mount
/dev/mapper/pve-root on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
/dev/sdb1 on /container type ext3 (rw)
/dev/sdc1 on /oradata type ext3 (rw)
/dev/sdd1 on /public type ext3 (rw)
blade2:~#

/var/lib/vz is now a symbolic link to /container/blade2/vz.

Kind regards,

Joachim
 
Actually it is a just LUN(?) of the SAS storage configured as „public“ and mounted to the directory /container on every Blade during bootup via /etc/fstab.

Sorry, but your fstab shows that you use 'ext3'

Code:
/dev/sdb1 on /container type ext3 (rw)

This will result in 100% data loss if you mount and access that from different servers! 'ext3' is not a shared filesystem.
 
Sorry, but your fstab shows that you use 'ext3'

Code:
/dev/sdb1 on /container type ext3 (rw)
This will result in 100% data loss if you mount and access that from different servers! 'ext3' is not a shared filesystem.
OK, I can change that. Question is if there is a solution at all; all blades mount the LUN as a DEVICE ...

Way it is now, on Blade2 I have the "common" director /container and a symbolic link from /var/lib/vz to /container/blade2/vz. I'll see if that works.

Kind regards,

Joachim