[Users] more filesystems inside a VE

Thorsten Schifferdecker tsd at debian.systs.org
Mon Nov 2 12:15:44 EST 2009


Hi,

frank wrote:
> Hi,
> recently we have had problems because a log file has filled all disk
> space inside a VE. To prevent this, it would be good to have a separate
> filesystem for log files. We have read the OpenVZ docs and we have only
> found how to add NFS,FUSER or bind mounts, all of them externals to VE.
> Is there another way to add more filesystems inside a VE ?
> 
You can use the "--devnodes" option of vzctl, give a ct access to an
hwdwarenode device

#
# here example with a logical_volume on lvm2 or use a "free" partion
#

create lv
# lvcreate -L <SIZE> -n <name_of_lv> <pv_group>

examine the major minor numbers
# ls -la /dev/mapper/<pv_group>-<name_of_lv>
brw-rw---- 1 root disk 253, 4 Nov  2 17:42
/dev/mapper/<pv_group>-<name_of_lv>

now let access "devnodes" of your hardwarenode to container
# vzctl set <ctid> --device b:253:4:rw --save

create a device, i use "hwdisk-00" as a example
# vzctl exec <ctid> 'mknod -m 660 /dev/hwdisk-00 b 253 4'

now you can use the ordinary disktool to access the "hardware"
# vzctl enter <ctid>

ctid> fdisk|cfdisk|sfdisk ... mkfs.<version_of_any_fs_loaded_on_hw>
ctid> mkfs.xfs|ext2|3 ...
ctid> mount /dev/hwdisk-00 /mntpoint
ctid> edit /etc/fstab

or

use the /etc/vz/conf/<ctid>.start "Action Script"
execute scripts in ct context on start process

---8<...
#!/bin/sh

#
# start script in containers context
# see Action Scripts on OpenVZ User Guide

mount /dev/hwdisk-00 /mnt

---8<...

!!! Be aware of using the partion on your hardware !!!


Bye,
 Thorsten


More information about the Users mailing list