5

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?

14

Use a bind mount:

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

You can also put these in fstab:

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

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

  • 1
    In the last code line, don't you mean /home/projects rather than just /home? – MariusMatutiae Oct 21 '13 at 19:54
4

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
  • soft-links! If only I had thought of that! :| Thanks! – Guru Prasad Oct 21 '13 at 16:04
  • 2
    Just a small follow up: This solution works quite well. The only downside to it is that you cannot run some linux utilities without including additional options to follow symlinks. For example, you cannot run find without including -follow. – Guru Prasad May 20 '16 at 21:35

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.