Lars Uffmann wrote:
I added the following to the bottom of the
/etc/udev/rules.d/50-udev.rules
rules file:
KERNEL="sd?1" KERNELS=="2:0:0:0" SUBSYSTEMS=="scsi" DRIVERS=="sd"
SYMLINK+="drawer0"
KERNEL="sd?1" KERNELS=="3:0:0:0" SUBSYSTEMS=="scsi" DRIVERS=="sd"
SYMLINK+="drawer1"
KERNEL="sd?1" KERNELS=="4:0:0:0" SUBSYSTEMS=="scsi" DRIVERS=="sd"
SYMLINK+="drawer2"
KERNEL="sd?1" KERNELS=="5:0:0:0" SUBSYSTEMS=="scsi" DRIVERS=="sd"
SYMLINK+="drawer3"
I had the KERNELS-information for my 4 hotplug-capable-SATA-drawers from
ls -l /dev/disk/by-path
Then, for the mounting, I used autofs:
apt-get install autofs
Add a new configuration for automounts:
vim /etc/auto.master
add line:
/media /etc/auto.removable --timeout=10,sync,nodev,nosuid
Create file /etc/auto.removable:
vim /etc/auto.removable
add lines:
drawer0 -fstype=vfat :/dev/drawer0
drawer1 -fstype=vfat :/dev/drawer1
drawer2 -fstype=vfat :/dev/drawer2
drawer3 -fstype=vfat :/dev/drawer3
Restart autofs:
/etc/init.d/autofs restart
This works a little different from how I originally intended, as it only
mounts the removable hard disks when I actually access the directories
/media/drawer[0-3], and unmounts them again after timeout (10 seconds)
if no read/write operations happen, but that is even better than
the permanent mount, because I don't even have to worry about manually
unmounting the removable hard disks.
Now I can write a tiny backup script which tells the user to "Insert a
backup medium into drawer X" and then backups to exactly that hard disk
as soon as it has been inserted, then gets ready for the next backup
cycle for whenever it is scheduled
I would still kind of like to figure out how to automount when the
device is created/plugged in and then just manually unmount when my
backup operation has finished.
Best Regards,
Lars