How can I mount a drive under my home directory at boot?

haneefmubarak

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:

/home/haneefmubarak/extradrive

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?

slm

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
NOTE

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.

References

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Can I Share a Home Partition on a Multi Boot USB Drive

분류에서Dev

How can I prevent file mode changes when working with a Git working directory on a shared drive under Bootcamp?

분류에서Dev

How can I copy files from my internal drive to an external USB 3.0 drive if Windows doesn't boot up?

분류에서Dev

Permissions issue: how can Apache access files in my Home directory?

분류에서Dev

How to organize my home directory?

분류에서Dev

How can I auto-mount my MicroSD?

분류에서Dev

How can i move an encrypted home directory to another partition?

분류에서Dev

How can I fix my Boot problem?

분류에서Dev

How can I create a udev rule to mount a USB drive read only?

분류에서Dev

How can one copy a directory tree from one drive to another, replicating any junction points, under Windows?

분류에서Dev

How can I format my portable hard drive as NTFS?

분류에서Dev

How can I repair my hard drive without losing files?

분류에서Dev

How can I delete the cygwin folder on my c drive?

분류에서Dev

How can I tell if my hard drive is PATA or SATA?

분류에서Dev

Best practice to mount directory in /home to directory in /media?

분류에서Dev

Best practice to mount directory in /home to directory in /media?

분류에서Dev

Can I copy my Ubuntu OS off my hard drive to a USB stick and boot from that stick with all my programs?

분류에서Dev

How do I prevent one user in particular from accessing my home directory?

분류에서Dev

How do I get Vim home directory?

분류에서Dev

how can i link an XML data file from my hard drive (not web) to my project?

분류에서Dev

How can I mount a subfolder of a shared folder?

분류에서Dev

My External Hard Drive fell and I cannot access storage anymore. How can I fix it?

분류에서Dev

How can I boot Windows 7 that is already installed on a hard drive on a UEFI system

분류에서Dev

Can I mount and run an iso from my terminal?

분류에서Dev

My external hard drive won't mount. I am using Ubuntu 14.10

분류에서Dev

How can I change the default location of content directories (eg Pictures, Templates, Music) in my home folder?

분류에서Dev

How can I sync my home folder "both ways" using rsync

분류에서Dev

How do I mount my main internal ext4 drive on a fresh install of Xubuntu 12.04? (Acer c7 320GB HDD)

분류에서Dev

Can I userdel a user without removing their home directory?

Related 관련 기사

  1. 1

    Can I Share a Home Partition on a Multi Boot USB Drive

  2. 2

    How can I prevent file mode changes when working with a Git working directory on a shared drive under Bootcamp?

  3. 3

    How can I copy files from my internal drive to an external USB 3.0 drive if Windows doesn't boot up?

  4. 4

    Permissions issue: how can Apache access files in my Home directory?

  5. 5

    How to organize my home directory?

  6. 6

    How can I auto-mount my MicroSD?

  7. 7

    How can i move an encrypted home directory to another partition?

  8. 8

    How can I fix my Boot problem?

  9. 9

    How can I create a udev rule to mount a USB drive read only?

  10. 10

    How can one copy a directory tree from one drive to another, replicating any junction points, under Windows?

  11. 11

    How can I format my portable hard drive as NTFS?

  12. 12

    How can I repair my hard drive without losing files?

  13. 13

    How can I delete the cygwin folder on my c drive?

  14. 14

    How can I tell if my hard drive is PATA or SATA?

  15. 15

    Best practice to mount directory in /home to directory in /media?

  16. 16

    Best practice to mount directory in /home to directory in /media?

  17. 17

    Can I copy my Ubuntu OS off my hard drive to a USB stick and boot from that stick with all my programs?

  18. 18

    How do I prevent one user in particular from accessing my home directory?

  19. 19

    How do I get Vim home directory?

  20. 20

    how can i link an XML data file from my hard drive (not web) to my project?

  21. 21

    How can I mount a subfolder of a shared folder?

  22. 22

    My External Hard Drive fell and I cannot access storage anymore. How can I fix it?

  23. 23

    How can I boot Windows 7 that is already installed on a hard drive on a UEFI system

  24. 24

    Can I mount and run an iso from my terminal?

  25. 25

    My external hard drive won't mount. I am using Ubuntu 14.10

  26. 26

    How can I change the default location of content directories (eg Pictures, Templates, Music) in my home folder?

  27. 27

    How can I sync my home folder "both ways" using rsync

  28. 28

    How do I mount my main internal ext4 drive on a fresh install of Xubuntu 12.04? (Acer c7 320GB HDD)

  29. 29

    Can I userdel a user without removing their home directory?

뜨겁다태그

보관