[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: auto-mounting disks that might not be present (e.g. usb drives)

Dave Thayer wrote, on 05/02/10 16:01:
On Wed, Feb 03, 2010 at 11:01:00PM +1030, Arthur Marsh wrote:
In my case I have:

UUID=4823-93A9  /mnt/usb8gig        vfat
0     2

(all on one line)

If I change that trailing "2" to a zero, no fsck should be performed.

I would like to have automatic mounting with fsck if the drive is
present when the machine is booted, and automatic mounting without
fsck if the drive is plugged in after the machine is booted.

Is this possible with any of the standard Debian tools and config
files, or will it require yet-another-script?

How about if you leave your fstab set up for no automount and no fsck,


UUID=4823-93A9 /mnt/usb8gig vfat defaults,users,uid=65534,gid=65534,umask=000,flush,shortname=win95,noauto 0 0

(all on the one line)

and then use a @reboot cronjob to fsck and mount the device if the
device node is present. For instance, in /etc/crontab you could try:

@reboot root test -L /dev/disk/by-uuid/4823-93A9 && fsck.vfat -a
/dev/disk/by-uuid/4823-93A9 && mount /mnt/usb8gig

(all on one line, with terminating newline)

OK, man 5 crontab shows that @reboot can be used instead of the first 5 fields of /etc/crontab

Last question is, what guarantee is there that the device file will have been generated (assuming that the USB drive is present) before the @reboot cron event is run?

incron might be able to help, but I haven't yet fully understood how to set up incron.

Thanks for your help!


Reply to: