stec-inc / EnhanceIO

EnhanceIO Open Source for Linux
Other
420 stars 177 forks source link

eio_cli udev rules possibly incorrect #21

Closed nikmartin closed 11 years ago

nikmartin commented 11 years ago

After issue #19 was closed, I fetched and built, and am still having persistence issues. here is my config: Laptop with 500 GB SATA HD, sda, partitoned like:

Number  Start   End     Size    File system     Name  Flags
 1      17.4kB  32.0MB  32.0MB                        bios_grub
 2      32.0MB  544MB   512MB   ext4               /boot
 3      544MB   401GB   400GB   ext4               /
 4      496GB   500GB   4096MB  linux-swap(v1) swap

32 GB Internal SSD, unformatted on /dev/sdb

I created a cache for /dev/sda3 using command:

sudo /sbin/eio_cli create -d /dev/sda3 -s /dev/sdb -m wt -c sda3_cache

And eio_cli created a udev file in /etc/udev/rules.d/94-enhanceio-sda3_cache.rules

With contents:


ACTION!="add|change", GOTO="EIO_EOF"
SUBSYSTEM!="block", GOTO="EIO_EOF"

ENV{ID_SERIAL}=="SATA_SSD_BA14072B040800328575", ENV{DEVTYPE}=="disk", GOTO="EIO_CACHE"

ENV{ID_SERIAL}=="dict_udev[ID_SERIAL]", ATTR{partition}=="3
", GOTO="EIO_SOURCE"

# If none of the rules above matched then it isn't an EnhanceIO device so ignore it.
GOTO="EIO_EOF"

# If we just found the cache device and the source already exists then we can setup
LABEL="EIO_CACHE"
        TEST!="/dev/enhanceio/sda3_cache", PROGRAM="/bin/mkdir -p /dev/enhanceio/sda3_cache"
        PROGRAM="/bin/sh -c 'echo $kernel > /dev/enhanceio/sda3_cache/.ssd_name'"

        TEST=="/dev/enhanceio/sda3_cache/.disk_name", GOTO="EIO_SETUP"
GOTO="EIO_EOF"

# If we just found the source device and the cache already exists then we can setup
LABEL="EIO_SOURCE"
        TEST!="/dev/enhanceio/sda3_cache", PROGRAM="/bin/mkdir -p /dev/enhanceio/sda3_cache"
        PROGRAM="/bin/sh -c 'echo $kernel > /dev/enhanceio/sda3_cache/.disk_name'"

        TEST=="/dev/enhanceio/sda3_cache/.ssd_name", GOTO="EIO_SETUP"
        PROGRAM="/bin/sh -c 'blockdev --setro $kernel'"  
GOTO="EIO_EOF"

LABEL="EIO_SETUP"
        PROGRAM="/bin/sh -c 'cat /dev/enhanceio/sda3_cache/.ssd_name'", ENV{ssd_name}="%c"
        PROGRAM="/bin/sh -c 'cat /dev/enhanceio/sda3_cache/.disk_name'", ENV{disk_name}="%c"

        TEST!="/proc/enhanceio/sda3_cache", RUN+="/sbin/eio_cli enable -d /dev/$env{disk_name} -s /dev/$env{ssd_name} -m wt -b 4096 -c sda3_cache"
LABEL="EIO_EOF"

But the rules don't seem to be firing on reboot, making the cache non-persistent.

nikmartin commented 11 years ago

I corrected the formatting, so the code above now accurately reflects the way it looks on disk, including carriage returns. I had previously created my own udev rule according to the Persistence.txt, and didn't have any better luck getting the rule to match. OS is Linux Mint, and I patched the distro 3.5.0-17 kernel, and also fetched the latest stable 3.8 from kernel.org, and patched and had the same result.

sanoj-stec commented 11 years ago

The mistake is ==> ENV{ID_SERIAL}=="dict_udev[ID_SERIAL]" Seems like python script for this requires fixing.