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
defaults,users,uid=65534,gid=65534,umask=000,shortname=win95
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,

Like:

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!

Arthur.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages

  • Re: sshfs installation error
    ... home machine with dynamic IP that's not 24/7 on the net. ... Another possible cause for disappearing files is file system corruption, ... /lost+found is empty and fsck says okay. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • SV: SV: Vinum, and poweroutage... HELP!
    ... Do you know why fsck are not able to scan the disk? ... And should a -b 32 fix the prob? ... >Network manager, NM Net ApS ... >>To unsubscribe, send any mail to ...
    (freebsd-questions)
  • Re: Downgrade FreeBSD 5.1 or 5.2 -> 4.9
    ... It helps to use UFS1 file systems. ... Probably have UFS issues, but I don't ... the way -CURRENT's fsck left things. ... I do not "unsubscribe" from email "services" to which I have not explicitly ...
    (freebsd-current)
  • Re: "recovering journal" at every system boot
    ... fsck 1.40-WIP ... sda1 filesystem was made by standard installer ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ... Trouble? ...
    (Debian-User)
  • Re: Problems on start of my system
    ... fstab: /etc/fstab:0: No such file or directory ... UNEXPECTED ICONSISTENCY; RUN fsck MANUALLY ... >> 0.4% fragmentation) ... To unsubscribe, ...
    (freebsd-questions)