[opensuse] Automatically mount removable disk
![](https://seccdn.libravatar.org/avatar/7527ff019b7a5078cb8647683a49d303.jpg?s=120&d=mm&r=g)
Hi, I'm trying out Bacula. I have a removable disk (Iomega REV) I want to use with Bacula to make backups. I want the backup-operator to plug in the disk, let Bacula make the backup next night and the following morning the backup operator replaces the disk with another one, etc. without doing anything on the PC. The problem is that the system does not mount the disk when no-one is logged in. I tried with autofs, but I can't make it work. When I ssh into the box I see the disk in /dev/disk/by-label. And disappears when removing the disk and reappears when inserting it. When I start autofs, I get the mount-point (/mnt/REV70), but AFAIK the disk is not mounted since I can't ls the directory and mount does not give the mount-point. I can manually mount the disk to the mount-point. Any suggestions ? Thanks. My /etc/auto.master : +auto.master <- tried without this /mnt/ /etc/auto.REV70 --timeout=30 My /etc/auto.REV70 : REV70 -fstype=auto,rw :/dev/disk/by-label/REV\x2070 I got these from the Bacula-wiki. Running on OS 11.1. -- Met vriendelijke groeten, Koenraad Lelong
![](https://seccdn.libravatar.org/avatar/2900b09e064ae279b7ea5af309c31a90.jpg?s=120&d=mm&r=g)
Hi Koenraad, I think if automount doesn't see the disk when it's started it will ignore the entry... Check out udev for that, it can trigger actions when new hardware is attached. I do have a file /etc/udev/rules.d/85-mount-fstab.rules: # check fstab and possibly mount SUBSYSTEM=="block", ACTION=="add", KERNEL=="sd*[0-9]|hd*[0-9]|sd*", RUN+="mount.sh" mount.sh is a script (has to be in /lib/udev) that takes neccessary actions. I use it for automatically mounting different USB devices at fixed mountpoints that I define in /etc/fstab using the /dev/disk/by-id links The mechanism/script is from an older openSuSE (10.3 I think), but the principle can easily be adapted to your needs. In your case it might be enough to either have an entry for the disk in /etc/fstab and instead of RUN+="mount.sh" try a RUN+="/bin/mount -a" (*), or stick with autofs but restart it after the disk is there using RUN+="/etc/init.d/autofs restart" (though I haven't tested those and cannot guarantee they work...) (*) in that case, as well in the one I'm using the backup script would have to umount the disk after it's done! Pit Koenraad Lelong wrote:
Hi, I'm trying out Bacula. I have a removable disk (Iomega REV) I want to use with Bacula to make backups. I want the backup-operator to plug in the disk, let Bacula make the backup next night and the following morning the backup operator replaces the disk with another one, etc. without doing anything on the PC. The problem is that the system does not mount the disk when no-one is logged in. I tried with autofs, but I can't make it work. When I ssh into the box I see the disk in /dev/disk/by-label. And disappears when removing the disk and reappears when inserting it. When I start autofs, I get the mount-point (/mnt/REV70), but AFAIK the disk is not mounted since I can't ls the directory and mount does not give the mount-point. I can manually mount the disk to the mount-point. Any suggestions ? Thanks.
My /etc/auto.master : +auto.master <- tried without this /mnt/ /etc/auto.REV70 --timeout=30 My /etc/auto.REV70 : REV70 -fstype=auto,rw :/dev/disk/by-label/REV\x2070 I got these from the Bacula-wiki. Running on OS 11.1. -- Met vriendelijke groeten, Koenraad Lelong
begin:vcard fn:Koenraad Lelong n:Lelong;Koenraad org:ACE electronics adr:Industriepark 2 nr 12;;IZ Webbekom 2118;Diest;VlaBra;3290;Belgie email;internet:k.lelong@ace-electronics.be title:R&D Manager tel;work:+32 13 531906 tel;fax:+32 13 531908 x-mozilla-html:FALSE url:www.ace-electronicss.be version:2.1 end:vcard
-- Dr. Peter "Pit" Suetterlin http://www.astro.su.se/~pit Institute for Solar Physics Tel.: +34 922 405 590 (Spain) P.Suetterlin@royac.iac.es +46 8 5537 8534 (Sweden) Peter.Suetterlin@astro.su.se -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
![](https://seccdn.libravatar.org/avatar/7527ff019b7a5078cb8647683a49d303.jpg?s=120&d=mm&r=g)
Pit Suetterlin schreef:
Hi Koenraad,
I think if automount doesn't see the disk when it's started it will ignore the entry...
Check out udev for that, it can trigger actions when new hardware is attached. I do have a file /etc/udev/rules.d/85-mount-fstab.rules: # check fstab and possibly mount SUBSYSTEM=="block", ACTION=="add", KERNEL=="sd*[0-9]|hd*[0-9]|sd*", RUN+="mount.sh"
mount.sh is a script (has to be in /lib/udev) that takes neccessary actions. I use it for automatically mounting different USB devices at fixed mountpoints that I define in /etc/fstab using the /dev/disk/by-id links
The mechanism/script is from an older openSuSE (10.3 I think), but the principle can easily be adapted to your needs.
In your case it might be enough to either have an entry for the disk in /etc/fstab and instead of RUN+="mount.sh" try a RUN+="/bin/mount -a" (*), or stick with autofs but restart it after the disk is there using RUN+="/etc/init.d/autofs restart" (though I haven't tested those and cannot guarantee they work...)
(*) in that case, as well in the one I'm using the backup script would have to umount the disk after it's done!
Pit Thanks for your response. I added in /etc/rules 85-mount-rev.rules : # mount Rev-drive SUBSYSTEM=="block", ACTION=="add", KERNEL=="sr*", RUN+="mount.sh"
In /lib/udev I have mount.sh (made mount.sh executable) : #!/bin/bash echo "udev rule triggered" >> /var/log/udev.log /bin/mount "/dev/disk/by-label/REV\x2070" /mnt/REV70 mountpoint /mnt/REV70 does exist. Is there a way to see what udev does ? Because I don't get anything. I tailed /var/log/messages and this is what I get when I insert a disk : Mar 6 15:57:49 linux-test kernel: UDF-fs INFO UDF: Mounting volume 'REV 70', timestamp 2009/02/26 15:12 (103c) Mar 6 15:57:49 linux-test hald: mounted /dev/sr2 on behalf of uid 0 When I run mount.sh manually it works fine. I rebooted the computer to make certain udev is restarted. Is it possible to restart udev without rebooting ? Or is it not needed to restart udev ? -- Met vriendelijke groeten, Koenraad Lelong
![](https://seccdn.libravatar.org/avatar/11b4b3cf016b1d6a62454324eaaacc59.jpg?s=120&d=mm&r=g)
On Friday 06 March 2009 09:10:18 am Koenraad Lelong wrote: ...
When I run mount.sh manually it works fine. I rebooted the computer to make certain udev is restarted. Is it possible to restart udev without rebooting ? Or is it not needed to restart udev ?
Try: /etc/init.d/boot.udev restart if nothing happens then rchal restart -- Regards, Rajko -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
![](https://seccdn.libravatar.org/avatar/77cb4da5f72bc176182dcc33f03a18f3.jpg?s=120&d=mm&r=g)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday, 2009-03-05 at 16:29 +0100, Koenraad Lelong wrote:
Hi, I'm trying out Bacula. I have a removable disk (Iomega REV) I want to use with Bacula to make backups. I want the backup-operator to plug in the disk, let Bacula make the backup next night and the following morning the backup operator replaces the disk with another one, etc. without doing anything on the PC. The problem is that the system does not mount the disk when no-one is logged in. I tried with autofs, but I can't make it work.
I would make the backup script mount the device, by label, and umount it when it finishes. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkmxZcMACgkQtTMYHG2NR9X2FACfXVrf3lgN1grZSkSuazKF3NaN w9MAoJBL8VleOqd7p3/zlHMMhdRCi7bh =mwve -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (4)
-
Carlos E. R.
-
Koenraad Lelong
-
Pit Suetterlin
-
Rajko M.