Two Distinct Mount Points with One Device

Two Distinct Mount Points with One Device

After being disappointed with Ubuntu's release update feature, I finally decided to have separate mount points for / and /home.

Towards this, I reformatted my HDD giving most of my drive to sda1(meant to be /home) and allocated about 40GB to rootfs (/). Unfortunately, I would also like to have a /projects which is to be located on sda1.

Currently, sda1 is being mounted as
/dev/sda1 on /home type ext4 (rw)
I've tried looking online for a solution to this problem..however, I'm not sure as to what to look for!

Is it possible to mount the 'home' directory of sda1 as /home and 'projects' directory of sda1 as /projects?

2 Answers

Use a bind mount:

mount /dev/sda1 /home
mount -t none -o bind /home/projects /projects

You can also put these in /etc/fstab:

/dev/sda1       /home      ext4 defaults  1 2
/home/projects  /projects  none bind      0 0

The rbind option is needed to make submounts visible, for example because /projects/apollo is on a separate partition. ro can be used to mount it read-only.

More details are available in the mount(8) man page, in the "Bind mount operation" section.

1

Step 1) Create a projects directory in the home folder.

Step 2) Create a symlink to this new directory from root.

mkdir /home/projects
ln -s /home/projects /projects
2

Your Answer

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

James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.