I needed to set up the permissions on an LV for my user in order to use it for VirtualBox. This is what I did (on Arch Linux):
In /etc/udev/rules.d/zz-vmdmsetup.rules:
SUBSYSTEM=="block", \
KERNEL=="dm-*",\
ACTION=="add|change", \
PROGRAM="/etc/udev/get-lv-name.sh %M %m", \
RESULT=="vm*", \
GROUP="nico", MODE="0660"
What this does - for "dm" devices, it will check the name via the get-lv-name.sh program, and if it starts with "vm", puts it in my user group and change the permission to g+rw.
Here is the get-lv-name.sh script:
#!/bin/sh
# Usage: get-lv-name.sh $MAJOR $MINOR
# Outputs the corresponding logical volume name
/sbin/dmsetup info -j $1 -m $2 |
/bin/grep Name |
/bin/cut -d '-' -f 2-
Finally to add it to VirtualBox:
vboxmanage internalcommands createrawvmdk
-filename /home/user/.VirtualBox/HardDisks/w7rc.vmdk
-rawdisk /dev/vg0/vm1 -register
What distribution/version are you using ? This does not seems to work on redhat 5.4
ReplyDelete