0

Ok so this is the scenario.

I have a separate partition from my Ubuntu partition. I use this 500GB partition to store important data to keep it all in one place.

On the 500GB partition I have a MISC folder. Next to MISC I want to store my /home data from Ubuntu.

I've followed the official Ubuntu guide Partitioning/Home/Moving to store my /home on the partition containing MISC without problems and it works fine.

The only thing is that now somehow MISC is inside of /home in Ubuntu... Whereas I wanted them to be folders side-by-side on the partition. I'm not sure if I should have specified a longer directory path ie; /home/MISC2

It seems like moving /home to the partition, in this case sda5, has swallowed the entire partition. Also the partition no longer shows up as a separate drive in the Files app, next to computer, usb, and cd-drives as it used to when Ubuntu wasn't using it to store /home.

I hope it's not too confusing, any help would be appreciated!

EDIT:

I want this 500GB partition to act as an independent drive, without Ubuntu directory structures. I want it just as a place to store/backup data.

So maybe I shouldn't have mounted it via fstab for /home...??? Instead should I have used --bind or symlink?

SeeKeR
  • 11
  • I might suggest something slightly different. Keep /home inside / (root), but move all data folders into your 500GB partition. Then link each folder back into /home. Then it looks like data is in /home but really in another partition. If all data folders copied to 500GB drive follow this for links: http://askubuntu.com/questions/223655/windows-ubuntu-dual-boot-share-files-between-os/223670#223670 – oldfred May 09 '16 at 16:05

2 Answers2

1

Answering my own question with the help of @oldfred and @ByteCommander

For my original purposes mounting the partition as /home was not what I really wanted. Reading a bit more about the differences between --bind and symlinks I found symlinks are what I wanted.

In the end I had to undo mounting /home to the partion, the reverse of the official guide and then create symlinks for all useful folders in /home (ie; Documents, Music, Pictures etc) like the links referenced by @oldfred

SeeKeR
  • 11
0

When you mount a partition to a directory, the partition's root directory will be mapped to the mount point directory.

Example:

sda1: /
     - bin/
     - home/

sda2: /
     - user1/
     - user2/
     - MISC/

So sda1 is your root partition and you are now mounting sda2 to the mount point directory /home/. This will then result in a directory structure like this:

sda1: /
     - bin/
     - home/
        - user1/
        - user2/
        - MISC/

You can not just pick a single directory out of a partition and mount that.

However, you can mount the partition anywhere else and then bind its subdirectories to where you actually want them. This will make them available through two paths. To make it easier, I would recommend you to place all directories that belong into /home in one directory, i.e. so that the structure of the second partition looks like this:

sda2: /
     - to_home/
        - user1/
        - user2/
     - MISC/

Then you create a mount point somewhere it does not disturb you, e.g.:

sudo mkdir /media/home_and_MISC

Now mount the partition there:

sudo mount /dev/sda2 /media/home_and_MISC

Then bind its content directories where you want them:

sudo mount --bind /media/home_and_MISC/home /home
sudo mount --bind /media/home_and_MISC/MISC /MISC

You can convert those mount commands into corresponding fstab entries of course.

Byte Commander
  • 107,489
  • So as a means of using the 500GB partition to backup/store important data from /home ie; /home/user/Documents,Music,Downloads,PIctures etc it seems I shouldn't have mounted it to /home via fstab and instead I should have used either --bind or symlink??

    @oldfred

    – SeeKeR May 09 '16 at 22:55
  • I mount to /mnt/data. And at top level of that data partition are all my folders like Documents, Music, etc and a few I add like your Misc. Then I link each folder into /home. Looks like standard structure in /home other than it also shows a link. http://ubuntuforums.org/showthread.php?t=1811198&p=11081384#post11081384 – oldfred May 09 '16 at 23:37