8

My current system is laid out across two drives:

  1. 40GB for / and /swap (dev/sdb)
  2. 1TB for /home (dev/sdc)

As my /home drive is running out of space, and storage is cheap, I've bought a 2TB drive with the intent of expanding /home across that drive too (so /home is spread over two drives/3TB).

I expected this to happen automagically (though I have no idea why I would expect that, really), the drive is installed (dev/sda), formatted as ext4, but I've no idea where to go next. Is this easy, is there a tool that can do this?

I've read the following questions:

But I can't piece together the advice in such a way that it makes sense to me, or how it enables:

  • Expansion of /home,
  • Auto-mounts the new drive.

I've been using Ubuntu for almost three years, and I still need schoolin'...sigh.

  • I can think of two solutions but I don't have have experience to turn it to into good answers. What I'm thinking of is to either mount the new drive in a directory of /home or to make your 1 TB and 2 TB drive into one logical partition with LVM and mount it in /home. – N.N. Jul 09 '11 at 12:28
  • @N.N.: thanks, if you could expand that into an answer, I'd certainly give it a go. Though, like you, I lack the experience to do so by myself, at least not without fairly explicit guidance. – David Thomas Jul 09 '11 at 12:37
  • Why does it have to be home? I have /, swap, /home at a total of 50 Gb and added my 2nd and 3rd internal disc under /discworld and /discworld2. – Rinzwind Jul 09 '11 at 13:16
  • @Rinzwind: mainly because on a multiple-user machine (without a hard drive per user) it seems to make more sense to share the potential space via /home, and slightly less trouble (once set up). – David Thomas Jul 09 '11 at 15:08
  • 1
    I've not had great experiences with LVM. IIRC, if you lose a drive you lose everything. It might be better/easier to just copy the contents of /home to the new drive then mount the new drive in at /home rather than the old partition. – tgm4883 Jul 09 '11 at 19:51
  • @tgm4883: well, I guess if the larger proportion of the material is media, it might be worth just mounting it as /media, and copying it all from the /home directory and into the new drive that way? It seems less intuitive than I've come to expect from *nix, though...but, again, I'm unsure why. =/ – David Thomas Jul 09 '11 at 20:16
  • Could you just symlink a folder in /home to the new drive? – Nathan Osman Jul 10 '11 at 01:21
  • @tgm4883 LVM can do mirroring, but usually, you leave it up to your RAID card (or mdadm to do it in software). We use LVM on our production DB servers, its very stable – Brian Jul 10 '11 at 03:46
  • @George, if you could provide instructions to do so then I'm certainly willing to try... – David Thomas Jul 10 '11 at 08:44

3 Answers3

5

Here are two packages that can merge two partitions in a single mountpoint:

unionfs-fuse - Fuse implementation of unionfs
mhddfs - file system for unifying several mount points into one
enzotib
  • 93,831
4

As mentioned in my comment, creating a symlink is probably the easiest way of accomplishing your goal. There is one downside to going this route and I'll explain it at the end.

Here's what you need to do:

  1. Find the mount point of your new 2TB drive. If the drive is currently mounted, you can easily find this information by running the mount command - which will list all currently mounted drives / partitions.
  2. Once you have the mount point, you can create a symlink to that folder in your home directory by running the following command:

    ln -s [MOUNT POINT]  ~/secondary

    This will create a folder in your /home directory named secondary that contains all of the contents of your 2TB drive. Now whenever you want to save something to your 2TB drive, simply save it in the secondary folder.

Now you've probably already spotted the downside to going this method. Although it is simple to set up, it doesn't automatically split content across the drive for you. You'll have to do this yourself. If you wanted to, you could copy all of the contents of a folder in your home directory (like Music or Desktop) to your 2TB drive and then replace 'secondary' with the name of that folder in the command above.

Nathan Osman
  • 32,155
  • Thank you, kindly! Is this really as difficult as it's meant to be ('difficult' defined, here, as having to ask the question in the first place)? Your solution accepted, plus-one-ed, and much, *much* appreciated. :) – David Thomas Jul 10 '11 at 21:30
  • @David: Glad I could help! – Nathan Osman Jul 10 '11 at 21:32
0

Yes you would need to do some hacking with LVM,but I think you would lose your data once you setup as an LVM partition. LVM is great if you use it from the start, but a pain in the but if you change your mind later. I would back up all of your data and reinstall from scratch and setup all of your drives for LVM and then restore the data from before.

Uri Herrera
  • 14,866
  • 2
    Saying, "go google this" it's not an answer, you could at least provide the OP with a link with what you could have found.There's a reason why he asked here instead of just googling. – Uri Herrera Jul 10 '11 at 01:22