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
  • 405

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.
  • 90,397
Fabby
  • 34,259
  • Don't thank me! ;-) Just click the little grey check-mark under the "0" now. If you do not like my answer, click on the little grey down-arrow below the 0, turning it into beautiful green and if you really like my answer, click on the little grey checkmark and the little up-arrow... If you have any further questions, go to http://askubuntu.com/questions/ask – Fabby Feb 13 '15 at 11:09
  • 1
    Not in a running system. ;) http://askubuntu.com/a/679669/367165 – A.B. Oct 10 '15 at 17:45