Linux fstab to mount different fs with the same label

If you have different partitions (such as USB ones) with the same label (so that you can syncro them with the same script) but with different filesystem (such as btrfs and ext4) you can modify your fstab line using auto instead of etx4 or btrfs.

I mean something like this:

LABEL="your-label"  /media/your-mount-path  auto  users,noauto,noatime,nodiratime  0  2

In this way you will be able to mount your usb devices (either etx4 or btrfs or another fs) without problems.

montare /smontare da terminale una chiavetta USB

Perché

Montare e soprattutto smontare da terminale una chiavetta USB in Linux ha il vantaggio che si può lasciare fisicamente la chiavetta nella sua porta USB rimanendo al tempo stessi sicuri che quanto doveva esservi scritto vi è già stato scritto e volendo si potrebbe sfilarla dalla porta quando si vuole, senza aspettare.
Se al contrario si usa la graficamente più comoda soluzione del safely remove, rimozione sicura della chiavetta, allora per poterla nuovamente montare (ed avere perciò praticamente disponibile) occorre sfilarla fisicamente e reinfilarla fisicamente nella porta USB.

Come

Dopo vari tentativi (tra cui con pmount) ho fatto così:

  • modificato il file etc/fstab aggiungendo una riga di questo tipo: LABEL=pen-drive /media/user/pen-drive etx4 user,rw,noauto 1 2
  • creato uno script bash per montare la chiavetta col comando “mount /dev/sdd5 /media/user/pen-drive”
  • e un altro script per smontare col comando “umount /media/user/pen-drive”