Gert
Posts: 171
Joined: Wed Oct 24, 2012 10:19 pm

Can fstab be adjusted for time delay when spin-up of disk takes longer ?

Wed Sep 18, 2019 12:19 am

Hello All,

To build a mini-NAS I have bought a new Seagate 5T 2.5inch disk and attached the USB to the RPI3. (Yes, it's slow and I plan to upgrade this rig to RPI4 with USB3) Seems the spin-up and self test of the disk take longer during the boot sequence than the point in time when mount is called. Thus on normal boot the disk is not mounted and missing from the file system.

Manually adding a

Code: Select all

mount -a 
works fine.

Question : Is there syntax in fstab to allow for a longer-than-usual spin-up of the disk?
I have seen fstab code to wait for network-up until a mount is issued. But this is a plain 'spinning-rust' device.

As a workaround (which I hope is not permanent) I've put the mounts into a crontab entry.

Code: Select all

@reboot sleep 30 && mount -a
My current fstab entry for the disk:

Code: Select all

UUID=F02E77D02E778E7A    /media/usbdisk ntfs-3g auto,user,exec,rw,nofail,noatime,errors=remount-ro 0 0
From the syslog:

Code: Select all

grep ' sd ' /var/log/syslog | grep '17 17'
Sep 17 17:00:47 rpi3 kernel: [    4.088699] sd 0:0:0:0: [sda] Spinning up disk...
Sep 17 17:00:47 rpi3 kernel: [    4.101507] sd 0:0:0:0: Attached scsi generic sg0 type 0
Sep 17 17:00:47 rpi3 kernel: [   10.325987] sd 0:0:0:0: [sda] Very big device. Trying to use READ CAPACITY(16).
Sep 17 17:00:47 rpi3 kernel: [   10.326241] sd 0:0:0:0: [sda] 9767541167 512-byte logical blocks: (5.00 TB/4.55 TiB)
Sep 17 17:00:47 rpi3 kernel: [   10.336904] sd 0:0:0:0: [sda] Write Protect is off
Sep 17 17:00:47 rpi3 kernel: [   10.336918] sd 0:0:0:0: [sda] Mode Sense: 4f 00 00 00
Sep 17 17:00:47 rpi3 kernel: [   10.337358] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Sep 17 17:00:47 rpi3 kernel: [   10.341385] sd 0:0:0:0: [sda] Very big device. Trying to use READ CAPACITY(16).
Sep 17 17:00:47 rpi3 kernel: [   10.450387] sd 0:0:0:0: [sda] Very big device. Trying to use READ CAPACITY(16).
Sep 17 17:00:47 rpi3 kernel: [   10.451484] sd 0:0:0:0: [sda] Attached SCSI disk
Sep 17 17:00:47 rpi3 kernel: [   12.247721] sd 1:0:0:0: [sdb] 249999360 512-byte logical blocks: (128 GB/119 GiB)
Sep 17 17:00:47 rpi3 kernel: [   12.247821] sd 1:0:0:0: Attached scsi generic sg1 type 0
Sep 17 17:00:47 rpi3 kernel: [   12.247938] sd 1:0:0:0: [sdb] Write Protect is off
Sep 17 17:00:47 rpi3 kernel: [   12.247951] sd 1:0:0:0: [sdb] Mode Sense: 23 00 00 00
Sep 17 17:00:47 rpi3 kernel: [   12.248268] sd 1:0:0:0: [sdb] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA
Sep 17 17:00:47 rpi3 kernel: [   12.260593] sd 1:0:0:0: [sdb] Attached SCSI removable disk
From the lsblk:

Code: Select all

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdb           8:16   1 119.2G  0 disk 
└─sdb1        8:17   1 119.2G  0 part /media/usbstick
sda           8:0    0   4.6T  0 disk 
├─sda2        8:2    0   4.6T  0 part /media/usbdisk
└─sda1        8:1    0   128M  0 part 
mmcblk0     179:0    0  29.7G  0 disk 
├─mmcblk0p2 179:2    0  29.7G  0 part /
└─mmcblk0p1 179:1    0    63M  0 part /boot
Seems Seagate sneaked a little partition in there.

Your feedback is appreciated.

Cheers,
Gert

PS : Let me know if there are other improvement to the fstab entry.

Andyroo

Re: Can fstab be adjusted for time delay when spin-up of disk takes longer ?

Wed Sep 18, 2019 12:35 am

You could try adding

Code: Select all

boot_delay=x
to config.txt to slow the whole boot process by ‘x’ seconds.

Try adding a file called timeout (no extension) to the /boot directory, that’s designed to add a wait in to the process for a tin disk to start to boot from.

The only other thing I have seen is the https://help.ubuntu.com/community/Autofs functions and that was on an x86 box so I’ve now idea if it’s happy on the Pi boards.

RedPanther
Posts: 39
Joined: Thu Sep 12, 2019 9:20 pm

Re: Can fstab be adjusted for time delay when spin-up of disk takes longer ?

Wed Sep 18, 2019 9:52 pm

Gert wrote:
Wed Sep 18, 2019 12:19 am
My current fstab entry for the disk:

Code: Select all

UUID=F02E77D02E778E7A    /media/usbdisk ntfs-3g auto,user,exec,rw,nofail,noatime,errors=remount-ro 0 0
PS : Let me know if there are other improvement to the fstab entry.
I hope I can be some help here Gert. I have a 4Tb 2.5” HDD that I have had mounted at boot on both a 3B+ and 4B

My current /etc/fstab entry for that drive looks about like this:

Code: Select all

PARTUUID=****************       /PiDrive/Drive01         ntfs         defaults       0   2
Use PARTUUID to specify a partition on the drive, change “ntfs-3g” to ntfs, unless you need all of the specifics for that drive to boot then set it to defaults, and change your last code number from “0” to 2 for the drive to mount at boot. 0 doesn’t mount the drive automatically, it only assigns the drive a mount link to the system at boot.

Might be worth a shot,
RP
One more is never enough ;)

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Can fstab be adjusted for time delay when spin-up of disk takes longer ?

Thu Sep 19, 2019 7:41 am

Unless you plan to use the external disk with a Windows or similar system, it would be better to reformat the partition as ext4. That will give you full Linux control over the permissions on the files and will be much faster than NTFS.

If you are going to use NTFS format, don't use "ntfs" in fstab. Use "ntfs-3g", otherwise you won't be able to write to it.
Unreadable squiggle

Gert
Posts: 171
Joined: Wed Oct 24, 2012 10:19 pm

Re: Can fstab be adjusted for time delay when spin-up of disk takes longer ?

Thu Sep 19, 2019 10:14 pm

OK, I have put a mount -a into crontab with a 30sec wait after boot. Kind of awkward but works and nothing else is slowed down. Was just wondering if there is a flag in fstab to wait for a device to be ready (or ready+xx sec) to execute the mounting.
Cheers,
Gert

RedPanther
Posts: 39
Joined: Thu Sep 12, 2019 9:20 pm

Re: Can fstab be adjusted for time delay when spin-up of disk takes longer ?

Tue Sep 24, 2019 6:02 pm

2019-09-24-135808_1280x1024_scrot.png
2019-09-24-135808_1280x1024_scrot.png (199.85 KiB) Viewed 300 times
I have had zero issues with read/write compatibility or speeds. Yes, my drive is also open to my iPhone, Windows 10 laptop, Ubuntu laptop, and four other Pi devices.
One more is never enough ;)

Return to “Troubleshooting”