Linux udev: Difference between revisions
From Lolly's Wiki
Jump to navigationJump to search
(Die Seite wurde neu angelegt: „/etc/udev/rules.d/99-custom.rules ENV{DM_VG_NAME}=="VolumeGroup1", ENV{DM_LV_NAME}=="LogicalVolume1", MODE="0660", OWNER="lollypop", GROUP="disk", SYMLINK+="Virt…“) |
No edit summary |
||
Line 1: | Line 1: | ||
[[Kategorie:Linux|LVM]] | |||
/etc/udev/rules.d/99-custom.rules | /etc/udev/rules.d/99-custom.rules | ||
ENV{DM_VG_NAME}=="VolumeGroup1", ENV{DM_LV_NAME}=="LogicalVolume1", MODE="0660", OWNER="lollypop", GROUP="disk", SYMLINK+="VirtualBox-$env{DM_NAME}" | ENV{DM_VG_NAME}=="VolumeGroup1", ENV{DM_LV_NAME}=="LogicalVolume1", MODE="0660", OWNER="lollypop", GROUP="disk", SYMLINK+="VirtualBox-$env{DM_NAME}" | ||
==udev ofr MySQL on LVM with InnoDB on raw devices== | |||
===Make your rule=== | |||
<source lang=bash> | |||
root@mysql:~# cat /etc/udev/rules.d/99-lvm-mysql-permissions.rules | |||
# udevadm info --query=all --name /dev/dm-0 | |||
# DM_VG_NAME=vg-data | |||
# DM_LV_NAME=lv-rawdisk-innodb01 | |||
ENV{DM_VG_NAME}=="vg-data" ENV{DM_LV_NAME}=="lv-rawdisk-innodb*" OWNER="mysql" | |||
</source> | |||
===Test your rule=== | |||
<source lang=bash> | |||
root@mysql:~# ls -al /dev/vg-data/lv-rawdisk-innodb01 | |||
lrwxrwxrwx 1 root root 7 Aug 12 14:45 /dev/vg-data/lv-rawdisk-innodb01 -> ../dm-0 | |||
root@mysql:~# udevadm test /class/block/dm-0 | |||
... | |||
read rules file: /etc/udev/rules.d/99-lvm-mysql-permissions.rules | |||
specified user 'mysql' unknown | |||
... | |||
</source> | |||
OK user mysql unknown... maybe I should install MySQL ;-). | |||
After that: | |||
<source lang=bash> | |||
root@mysql:~# id -a mysql | |||
uid=108(mysql) gid=114(mysql) groups=114(mysql) | |||
root@mysql:~# udevadm test /class/block/dm-0 2>&1 | grep OWNER | |||
OWNER 108 /etc/udev/rules.d/99-lvm-mysql-permissions.rules:4 | |||
</source> |
Revision as of 14:03, 12 August 2015
/etc/udev/rules.d/99-custom.rules
ENV{DM_VG_NAME}=="VolumeGroup1", ENV{DM_LV_NAME}=="LogicalVolume1", MODE="0660", OWNER="lollypop", GROUP="disk", SYMLINK+="VirtualBox-$env{DM_NAME}"
udev ofr MySQL on LVM with InnoDB on raw devices
Make your rule
root@mysql:~# cat /etc/udev/rules.d/99-lvm-mysql-permissions.rules
# udevadm info --query=all --name /dev/dm-0
# DM_VG_NAME=vg-data
# DM_LV_NAME=lv-rawdisk-innodb01
ENV{DM_VG_NAME}=="vg-data" ENV{DM_LV_NAME}=="lv-rawdisk-innodb*" OWNER="mysql"
Test your rule
root@mysql:~# ls -al /dev/vg-data/lv-rawdisk-innodb01
lrwxrwxrwx 1 root root 7 Aug 12 14:45 /dev/vg-data/lv-rawdisk-innodb01 -> ../dm-0
root@mysql:~# udevadm test /class/block/dm-0
...
read rules file: /etc/udev/rules.d/99-lvm-mysql-permissions.rules
specified user 'mysql' unknown
...
OK user mysql unknown... maybe I should install MySQL ;-).
After that:
root@mysql:~# id -a mysql
uid=108(mysql) gid=114(mysql) groups=114(mysql)
root@mysql:~# udevadm test /class/block/dm-0 2>&1 | grep OWNER
OWNER 108 /etc/udev/rules.d/99-lvm-mysql-permissions.rules:4