User Tools

Site Tools


tech:linux_server_new_drive

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
tech:linux_server_new_drive [2026/09/29 19:34] – Added Section for SMB and minor updates katsimbristech:linux_server_new_drive [2026/10/01 16:33] (current) – add timeout katsimbris
Line 186: Line 186:
  
 <code bash> <code bash>
-echo 'UUID=a28ee7c4-9f5a-468a-a7aa-c82acdb2c798 /mnt/media8 ext4 defaults,nofail 0 2' | sudo tee -a /etc/fstab+echo 'UUID=a28ee7c4-9f5a-468a-a7aa-c82acdb2c798 /mnt/media8 ext4 defaults,nofail,x-systemd.device-timeout=60 0 2' | sudo tee -a /etc/fstab
 </code> </code>
  
Line 192: Line 192:
  
 This prevents a failed, disconnected, or missing storage drive from preventing Ubuntu from booting. This prevents a failed, disconnected, or missing storage drive from preventing Ubuntu from booting.
 +
 +''x-systemd.device-timeout=60'' tells systemd to wait up to 60 seconds for the drive to become available during boot. This is useful for external USB storage, because some drives may take longer to initialize when several drives are connected.
 +
 +The combination:
 +
 +<code>
 +nofail,x-systemd.device-timeout=60
 +</code>
 +
 +means that Ubuntu will give the drive up to 60 seconds to appear, but will still continue booting if the drive is missing or unavailable.
  
 The entry follows this format: The entry follows this format:
  
 <code> <code>
-UUID=FILESYSTEM-UUID /mnt/NAME ext4 defaults,nofail 0 2+UUID=FILESYSTEM-UUID /mnt/NAME ext4 defaults,nofail,x-systemd.device-timeout=60 0 2
 </code> </code>
  
Line 202: Line 212:
  
 <code> <code>
-UUID=a28ee7c4-9f5a-468a-a7aa-c82acdb2c798 /mnt/media8 ext4 defaults,nofail 0 2+UUID=a28ee7c4-9f5a-468a-a7aa-c82acdb2c798 /mnt/media8 ext4 defaults,nofail,x-systemd.device-timeout=60 0 2
 </code> </code>
  
-===== 9. Reload systemd =====+===== 9. Reload systemd and Validate fstab =====
  
 After changing ''/etc/fstab'', run: After changing ''/etc/fstab'', run:
Line 211: Line 221:
 <code bash> <code bash>
 sudo systemctl daemon-reload sudo systemctl daemon-reload
 +</code>
 +
 +Validate the ''fstab'' configuration:
 +
 +<code bash>
 +sudo findmnt --verify --verbose
 +</code>
 +
 +The important result is that there are no parse errors or errors.
 +
 +Warnings may still appear for certain filesystem types or the swap file and do not necessarily indicate an invalid ''fstab'' entry.
 +
 +For a media drive using the recommended settings, ''findmnt'' should show:
 +
 +<code>
 +userspace options: nofail,x-systemd.device-timeout=60
 </code> </code>
  
Line 260: Line 286:
 <code> <code>
 [media8] [media8]
-   path = /mnt/media8 +path = /mnt/media8 
-   browseable = yes +browseable = yes 
-   read only = no +read only = no 
-   valid users = mike +valid users = mike 
-   force group = media +force group = media 
-   create mask = 0664 +create mask = 0664 
-   directory mask = 0775+directory mask = 0775
 </code> </code>
  
Line 273: Line 299:
 <code bash> <code bash>
 sudo tee -a /etc/samba/smb.conf >/dev/null <<'EOF' sudo tee -a /etc/samba/smb.conf >/dev/null <<'EOF'
- 
 [media8] [media8]
-   path = /mnt/media8 +path = /mnt/media8 
-   browseable = yes +browseable = yes 
-   read only = no +read only = no 
-   valid users = mike +valid users = mike 
-   force group = media +force group = media 
-   create mask = 0664 +create mask = 0664 
-   directory mask = 0775+directory mask = 0775
 EOF EOF
 </code> </code>
Line 369: Line 394:
 <code bash> <code bash>
 sudo blkid /dev/sdi2 sudo blkid /dev/sdi2
 +</code>
 +
 +Check that all expected media mounts are currently mounted:
 +
 +<code bash>
 +for m in /mnt/media{1..8} /mnt/internal; do
 +  if mountpoint -q "$m"; then
 +    echo "OK      $m"
 +  else
 +    echo "MISSING $m"
 +  fi
 +done
 +</code>
 +
 +Validate ''/etc/fstab'':
 +
 +<code bash>
 +sudo findmnt --verify --verbose
 </code> </code>
  
Line 385: Line 428:
 ===== Important Notes ===== ===== Important Notes =====
  
-* Never format a drive until its identity has been confirmed using its size, model, serial number, existing filesystem, and mount status. \\ +  * Never format a drive until its identity has been confirmed using its size, model, serial number, existing filesystem, and mount status. 
-* Do not rely on names such as ''/dev/sdi'' remaining permanent. Linux device letters can change between boots or when USB drives are connected in a different order. \\ +  * Do not rely on names such as ''/dev/sdi'' remaining permanent. Linux device letters can change between boots or when USB drives are connected in a different order. 
-* Permanent mounts should therefore use filesystem UUIDs in ''/etc/fstab''. \\ +  * Permanent mounts should therefore use filesystem UUIDs in ''/etc/fstab''. 
-* All external/data-drive mounts on this server should use ''nofail'' so that a missing storage drive cannot prevent the server from booting. \\ +  * All external/data-drive mounts on this server should use ''nofail'' so that a missing storage drive cannot prevent the server from booting. 
-* SMB shares should be validated with ''sudo testparm'' before reloading Samba.+  * External/media drives should use ''x-systemd.device-timeout=60'' so that slower USB drives have enough time to become available during startup. 
 +  * The recommended combination for media drives is ''nofail,x-systemd.device-timeout=60''. 
 +  * SMB shares should be validated with ''sudo testparm'' before reloading Samba.
tech/linux_server_new_drive.1790724893.txt.gz · Last modified: by katsimbris