Spread /home partition over two drives?

14,499

It seems like you need a bit more information on the Linux directory system: You have one root directory / on your system. And this is where you have a number of folders like /home, /dev, /usr, /etc and so on. Some of the folders really exist on the disk, like home, usr and etc, but some are only virtual like proc or dev and contain temporary system/process/device info/represent them.

Now you have to understand that EVERY machine has this equal basic structure, independent of the underlying partitions. Every partition you mount gets placed into this one file system tree and bind to one specific directory. So e.g. your /home directory points to the partition sdb1 (which is represented by /dev/sdb1 by the way) while your /boot folder is located at sda1 and the rest of / is in sda2.
You can also just create a new folder like ~/data and bind the partition to this new folder.

So for your system you can say the following:

The only two partitions you need are / (the tree root) and swap (which does not get included into the tree). Then all data in any real directory under / would be stored in the root partition.
What you can do now is to take specific directories out of the root partition / and assign their own partition to them. Commonly you do this for /home and sometimes for /boot.

It is easy to do this at install time (select "do something else" when it ask whether it should install instead/alongside other OS and do the partitioning manually), but a bit more difficult to change it later, as you have to manually move the contents from the old directory to the new partition before you bind it. But it is of course possible and - this is the big advantage of this directory system - applications will not see any changes, as they still can access their files as before, because the path (e.g. /home/myusername/.mygame/hiscore) to all files stayed the same.

So what do you exactly want to do now and on which topic do you need further help?

file system/mounting visualization
image source:
http://h0lug.sourceforge.net/ForrestHo00/samples/ooo11/openOfficeEmbeddedImage/zip-Sernet-LATM-LPI-101-v-0.2-20050712-1243-noXSO.sxw/file-Pictures/10000000000002D00000021CF2F25855.png

Share:
14,499

Related videos on Youtube

RootFAIL
Author by

RootFAIL

Updated on September 18, 2022

Comments

  • RootFAIL
    RootFAIL over 1 year

    I have two 160GB drives on my laptop - sda and sdb. Is there any way to create a /home partition with more than 160GB? I tried to create a /home partition on both drives, but then it told me that I couldn't install Ubuntu with multiple /home partitions.

    • Byte Commander
      Byte Commander about 9 years
      I don't know, but you can create a normal ext4 data partition on the second drive and mount it into a new directory of your /home folder. So all files in /home would be on disk one, except those in that specific folder (e.g. call it Data2). You could also mount it and bind it over an existing directory like ~/Videos and store all your Videos on the second disk. To better manage the space, you would have to create more than one partition and assign an equivalent number of directories.
    • Jos
      Jos about 9 years
      This is what Logical Volume Management was designed for. However, @ByteCommander's method is far easier.
    • RootFAIL
      RootFAIL about 9 years
      @ByteCommander Would I be able to do the reverse? As in install swap, root, boot, and the normal ext4 on sda, and then mount that onto the home partition on sdb? Forgive my ignorance, but what should the mount point be for the normal ext4? Thanks!
  • RootFAIL
    RootFAIL about 9 years
    I am doing a fresh install of Ubuntu using the "do something else" option. If I understand correctly, you're saying that making a partition for home just sets aside space for that directory? I am still not clear on how I should partition it to allocate more space for files and programs (eg. armory and the massive blockchain). Is there a mount point called /data? Should it be logical or primary? Thanks again!
  • Byte Commander
    Byte Commander about 9 years
    I will look for a graphical explanation on the mount/bind thing. Programs would usually get installed somewhere inside /usr/ or /bin/ or /opt/ or /lib/ or get split over many of them. So I personally would just create a root "/" on sda1 for system and programs and everything else, a swap (about 1-2x your RAM size) on sda2 (if primary) or sda5 (automatically set if you chose logical), and allocate the whole second disk on sdb1 as /home/ to store your personal files and data. You can use primary partitions, as you only need logical ones to go around the limit of 5 partitions per disk.
  • RootFAIL
    RootFAIL about 9 years
    Is this what you are talking about? askubuntu.com/questions/138547/…
  • Byte Commander
    Byte Commander about 9 years
    If it helps you it is good. I thought more about visualizing how all partitions are mounted into that one directory tree.
  • karel
    karel over 3 years
    This answer isn't clear enough for the question to be used as a duplicate target. I would prefer something like: You could create a filesystem on the 2nd partition and persistent mount that directory to a mount point in your home directory through fstab. link