In my current setup, I have a RAID0 array of 2x3TB HDDs with btrfs, two partitions:

  • /
  • /home

Under the /home directory, there are two users, both admin, one of which is myself.

So far, this setup is working out pretty nicely, although btrfs is fairly slow.

I recently acquired a pretty nice 500 GB SATA HDD. I'm going to format it w/ ext4 or XFS for increased performance for ephemeral things like my testing VMs and such. I would like to mount it under my home directory at boot, ie:


The first thing that came to my mind was to use /etc/fstab, but AFAICT then the permissions won't be set correctly for me to normally use it.

Essentially, I want to mount the drive so that it is mounted at ~/extradrive with permissions set like any other directory, so that I "own" the entire drive. How can I go about doing this?

  • 1
    Could I have a reason for downvote? I accidentally hit save early, but I edited in the rest. Nov 30 '14 at 4:03
  • I downvoted because the question was incomplete. Now I know that was an accident which you've corrected (thanks), but I'm afraid I still don't understand what exactly the problem is. So you set /etc/fstab to mount the new filesystem at /home/haneefmubarak/extradrive, which should work fine (unless your home directory is encrypted). And like you say, you set its permissions the way you want them like any other directory so that you own it (using chown, presumably). So what's the problem?
    – Celada
    Nov 30 '14 at 4:18
  • 1
    Well, I'd like to not have to do sudo chown every time I reboot my computer. I'm looking for a way to persist the permissions across boots. Also, I haven't actually done this yet, I'm just speculating at this point from prior experience. Nov 30 '14 at 5:18
  • Why do you imagine you would have to chown it every time your reboot your computer? Do you think the ext4 filesystem you plan to use would "forget" its data in between boots?
    – Celada
    Dec 1 '14 at 1:12
  • 1
    @Celada no, but I do think that the unmount and remount at boot would reset the permissions at the mount point. Dec 1 '14 at 1:18

Method #1

Try a line like this in /etc/fstab:

UUID=XX  /home/user/extradrive ext3   rw,noauto,user,sync          0  2

Method #2

Examples are also shown using UID/GID too:

UUID=XX  /home/user/extradrive ext3   rw,exec,uid=userX,gid=grpX   0  2

You can also override when doing the actual manual mounting like this using mount + options:

$ sudo mount <device> <mount-point> -o uid=foo -o gid=foo

Method #3

Lastly, you can avoid the whole business by making the top level of the mounted extra drive owned by userX/groupX like so, after manually mounting the HDD:

$ sudo chown -R userX.groupX <directory>

Then in /etc/fstab do

<device>    <directory>  ext3   user,defaults 0 2

The userX should now be able to access the drive upon reboots.

NOTE: There's an assumption that the /home/userX has already been mounted with several of the options above. So take care that its been mounted prior.


  • Would adding the mount line to the bottom of fstab ensure that /home and others are mounted prior to this being mounted? Dec 1 '14 at 20:15
  • @haneefmubarak - yes.
    – slm
    Dec 1 '14 at 20:36

There are two things involved with accessing material on the drive once mounted:

  • permissions on the mount directory
  • permissions on the individual material

With the first can restrict others to have access to any material on the drive by setting chmod o- ~/extradrive, or even everyone but yourself `(chmod go-rwx ~/extradrive)

Ownership of individual files/directories on the mounted drive is permanent, so you only have to chown the once, not after every mount. You might have experienced problems in the past with filesystems that did not have detailed owner information, but ext4/XFS will not give you these problems. So even if you allow others access via the mount point, they cannot do much on the drive unless they have write permissions in any of the subdirectories.

It is definitely a good idea to not put VMs disc files on Btrfs. You might want to look at defragmenting / and /home after rearranging your material.

  • 1
    Well the problem isn't the files maintaining their permissions, it's the mount point maintaining the correct owner. AFAICT, when a file is mounted from /etc/fstab, the owner is set to root:root. I'd like it to be automatically set to haneefmubarak:haneefmubarak. Nov 30 '14 at 6:56
  • @haneefmubarak in that case mount with something like -o umask=750,gid=ownerGroupID,uid=ownerID or adjust the entry in the /etc/fstab accordingly.
    – Anthon
    Nov 30 '14 at 10:22

I solved this with mount --bind

  1. sudo crontab -e
  2. add a line: @reboot sleep 30; bash /usr/local/sbin/mnt.sh

with mnt.sh as follows:

mount --bind /home/yourname/afolder /media/yourname/drive/afolder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.