0

I have an external HDD and when I plug it in, I'd like it that Ubuntu always mounted it to a particular mountpoint and with particular read/write permissions.

To be more precise, I have an external drive with a partition called "Backup" (/dev/sdb1) and I'd like it to me mounted to /media/Backup with read-only permissions. What's the easiest way to do that?

orion3
  • 415

1 Answers1

0

All of the parameters of the following how-to are explained in the official Ubuntu documentation for fstab

  1. Insert the USB drive
  2. Go to a terminal and type sudo blkid and you should receive the following output:

    /dev/sdb1: LABEL="BACKUP" UUID="mmmmmmmm-nnnn-oooo-pppp-qqqqqqqq" TYPE="szFileSystem"
    

If the label does not say "BACKUP", you made a mistake in assigning a name to your stick. Open gparted, unmount the volume and set the correct label.

  1. In the same terminal, type sudo md /media/BACKUP
  2. and: chmod -w /media/BACKUP
  3. and: sudo nano /etc/fstab/
  4. Download a nice square back-up icon and save it to /usr/share/pixmaps in png format.
  5. At the end of the file add:

    UUID=mmmmmmmm-nnnn-oooo-pppp-qqqqqqqq /media/BACKUP szFileSystem nosuid,nodev,noexec,users,nobootwait,nofail,ro,comment=x-gvfs-show,comment=x-gvfs-icon=NiceBackupIcon,comment=x-gvfs-name=BACKUP   0   2
    

where:

  • mmmmmmmm-nnnn-oooo-pppp-qqqqqqqq is the UUID from step 2
  • szFileSystem is the file system from step 2
  • NiceBackupIcon is the icon you downloaded in step 6 (note: no png file extension)
A.B.
  • 92,125
Fabby
  • 35,017