Ask Your Question
1

How to automount GPT partitions and set read/write permissions?

asked 2013-02-01 13:38:06 -0600

Bucic gravatar image

How do I make partitions on my GPT disk automount on startup - for each of the following scenarios:

  1. Every user can read and write the data.
  2. Every user can read (read only) the data, but only I have read/write permissions.

May I remind you:
The util fdisk doesn't support GPT. Use GNU Parted.

What I have already tried:
Udisks Gnome tool (Disks) shows More actions > Edit mount options > Automatic mount options: ON

What happened:
My external USB hard drive was automounting just fine. Then I taken it out of the case and connected via SATA ultrabay. It works, just the system asks for authentication when I try to access the partitions.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-02-03 00:06:26 -0600

updated 2013-02-04 02:22:06 -0600

Make an entry in /etc/fstab for the filesystem. I'm using a random USB flash drive off my desk, but this works for any persistent storage that you want a predictable mountpoint for.

  • Identify your filesystem's UUID - a unique identifier - in the output of blkid. Using a UUID instead of eg. /dev/sdb1 makes sure that other filesystems don't get incorrectly mounted.

    $ su -c 'blkid'

    (snip)

    /dev/sdd1: LABEL="New Volume" UUID="9723-D67F" TYPE="vfat"

  • Make a directory to use as your mount point, and apply the permissions you feel appropriate. The example will allow the user 'bucic' to read, write, and execute on the filesystem; other users can only read and execute.

    $ su -c 'mkdir /mnt/portable'

    $ su -c 'chown bucic /mnt/portable '

    $ su -c 'chmod 0755 /mnt/portable'

  • Open /etc/fstab in your editor of choice:

    $ su -c 'nano /etc/fstab'

  • Add an entry in /etc/fstab for this filesystem. The first line in my example below is generic replaceables, the second is my specific example. The mount options given will not attempt to mount the filesystem on boot, but when any user attempts to access /mnt/portable, it will be mounted immediately.

UUID=anyuuid /mount/point/ fstype options 0 0

UUID=9723-D67F /mnt/portable vfat user,noauto,comment='systemd.automount' 0 0

  • Mount all to test:

    $ su -c 'mount -a'

edit flag offensive delete link more

Comments

Sure, I can give a better answer - edits above.

randomuser gravatar imagerandomuser ( 2013-02-04 01:52:21 -0600 )edit

File manager still asks me for password. su -c 'mount -a' returns no errors. I used /media/myusername/disklabel for mount point and modified the chown and chmod commands accordingly. PCManFM gives the following error: Error mounting system-managed device /dev/sdb4: Command-linemount "/media/hg1/HIT_160/"' exited with non-zero exit status 32: mount: wrong fs type, bad option, bad superblock on /dev/sdb4,`

Bucic gravatar imageBucic ( 2013-05-13 16:02:06 -0600 )edit

Can you post the line you made in /etc/fstab and the command you're running to mount?

randomuser gravatar imagerandomuser ( 2013-05-13 20:32:25 -0600 )edit

@randomuserUUID=fdbb2c7f-05c4-4797-993c-89607dbf42d9 /media/hg1/HIT_160/ ext4 hg1,noauto,comment='systemd.automount' 0 0 (separated by spaces, separation by TABs tested as well, with the same result). Command used to mount is su -c 'mount -a.

Bucic gravatar imageBucic ( 2013-05-14 15:57:50 -0600 )edit

Your options column is missing the 'user' entry that would allow regular users to mount. With that in place, the 'comment=systemd.automount' should allow the directory to be automatically mounted when you attempt to access it.

randomuser gravatar imagerandomuser ( 2013-05-14 17:16:34 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-02-01 13:38:06 -0600

Seen: 7,260 times

Last updated: Feb 04 '13