More robust drive set-up than fstab?

I have a volume listed in fstab, an external USB hard disk drive:

/dev/sda2 /media/tm hfsplus force,rw,user,auto 0 0

If the drive is not connected, the Pi won't even boot up. Is there a way to have a drive that will mount at a certain mount point if it's available, without hanging the system if it's not?

Thanks,

Daniele

Reply to
D.M. Procida
Loading thread data ...

You want ?noauto? instead of ?auto?.

--
https://www.greenend.org.uk/rjk/
Reply to
Richard Kettlewell

Am 18.07.2018 um 12:17 schrieb D.M. Procida:

i would try with /dev/sda2 /media/tm hfsplus rw,user,auto,nofail,x-systemd.device-timeout=1 0 0 eventually noauto,automount

greetings Chrigu

Reply to
Christian Schweingruber

Lose the "force" option, add "nofail". I would use: /dev/sda2 /media/tm hfsplus defaults,nofail 0 0

--

Chris Elvidge, England
Reply to
Chris Elvidge

That still hangs if I boot without the drive attached.

Not having a display to attach to the Pi here, it's a tedious business of trial and error (and wiping the SD card when it's an error, since I'm also able to edit files on it from macOS).

Daniele

Reply to
D.M. Procida

'man fstab' seems to indicate it would be 'noauto'

Reply to
ray carter

Two previous posters have mentioned changing "auto" to "noauto". That is the correct solution. I have two to four volumes mounted at any one time, but many disks mentioned in my /etc/fstab. All of the ones I don't want automatically mounted at startup have the "noauto" option.

But no one has mentioned the other issue there for a "robust" fstab: don't use the drive path. Use a disk label or a UUID. I'm partial to UUIDs myself:

# misc old harddrives UUID=53958d65-ca0a-46d7-8964-956b39e026de /5395 ext4 noauto 0 0 UUID=53946765-20ae-4693-bfe0-a546242379d7 /5394 ext4 noauto 0 0 UUID=10afd738-11f1-4707-bc0d-172e7e940fc2 /10af ext4 noauto 0 0 UUID=2bd5733b-93a9-4c65-b282-44cf8cf8fb73 /2bd5 ext4 noauto 0 0 UUID=cc54c725-dd22-4165-9e0c-1baf8f1f4896 /cc54 ext3 noauto 0 0

But the first example in the fstab manpage (at least in my distro) uses a "LABEL=t-home2" entry. Either way, it specifies a disk in a way that is independent of the sequentially issued /dev/sd[abcdef...] devices. So if you plug in a USB thumb drive before your /media/tm (Mac time machine disk, I'm guessing), you can still mount it.

For me, the easy way to find a UUID is this sequence:

ls /dev/disk/by-uuid

(Attach new device and wait a few seconds for it to be recognized)

ls /dev/disk/by-uuid

(Look for what's changed.)

The entries in /dev/disk/by-uuid are symlinks to the ordinary device files, so if you need to figure out what's a /dev/sda2 versus a /dev/sda3 you can use "ls -l" instead. Other people use the blkid program, but that requires root.

Every filesystem has a different style of UUID. The examples above are all ext2/3/4 style. FAT looks like "UUID=3736-BD70" and NTFS looks like "UUID=C8F681D7F681C662". Off the top of my head, I don't know what HFS / HFSPlus ones look like.

Elijah

------ has a bunch of more memorably named directories for thumbdrives

Reply to
Eli the Bearded

This is the most useful response you got, but my experience with hfs+ drives is that it doesn?t matter if you tune your fstab perfectly, it will always have trouble with mounting, spontaneously unmounting, remounting from sda to sdb or from rw to ro. Apparently the write-mode driver just isn?t stable. And yes, even with journaling disabled on the hfs+ drive (which you definitely need to do before trying to mount as rw, google it).

Reply to
A. Dumas

After attaching the device(s), one can just

sudo blkid

blkid - locate/print block device attributes

And some light reading for the curious.

formatting link
formatting link

--
Consulting Minister for Consultants, DNRC 
I can please only one person per day. Today is not your day. Tomorrow 
 Click to see the full signature
Reply to
I R A Darth Aggie

I did mention that tool in my post. I don't find it very useful. Your mileage may vary. (And if you only do it after, how do you know what's recently attached? With 'ls -l' on the by-uuid directory, there are time stamps...)

Elijah

------ or 'ls -rt1 /dev/disk/by-uuid'

Reply to
Eli the Bearded

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.