15

I have a server with three hard drives:

  1. 250 GB
  2. 3 TB
  3. 250 GB

How can I merge multiple hard drives as one bigger volume of ~ 3.5 TB? I am a programmer not a system administrator.

  • 8
    Reconsider it twice, as if you'll go for it with those drives you will not be able to setup proper RAID and in case one of your hdd fails you might lose all data in Volume... – Petr Dec 12 '16 at 12:45
  • 4
    Are all of these drives mechanical harddrives? Such small drives are not really common these days and are probably very old. I'd seriously reconsider using these for data. If these are SSDs: Don't put them in a RAID/LVM/something together with mechanical drives. Also: In your configuration, if one of your 3 drives fails, all your data is lost. Thats a very bad risk to take. – Tobias Mädel Dec 12 '16 at 13:09
  • 2
    Depends of what you mean to use them for? – Braiam Dec 12 '16 at 16:54
  • Do you need to preserve the data currently on those drives? – Mark Plotnick Dec 12 '16 at 23:48
  • 1
    To amplify what @TobiasMädel said: 250GB disks were popular 6 to 8 years ago. If your disks are that old and have been in use daily, it is risky to rely on them. Use them as if they could fail any day. – Mark Plotnick Dec 12 '16 at 23:56
20

Use LVM (Logical Volume Management) on Linux.

You can think of LVM as "dynamic partitions", meaning that you can create/resize/delete LVM "partitions" (they're called "Logical Volumes" in LVM-speak) from the command line while your Linux system is running: no need to reboot the system to make the kernel aware of the newly-created or resized partitions.

First of all you can use fdisk with -l option to get info about your current "Disks", then use it to partition your "Disks" and setting the system type of those partitions to "Linux LVM", after you finish the partitioning of the "Disks", use pvcreate to prepare your new partitions for "LVM".

For more info: https://www.howtoforge.com/linux_lvm

  • 1
    another link : wiki.ubuntu.com/Lvm (which is weird as they give the example of a Logical Volume on 1 hard drive, but of course you can have multiple physical drives in the same logical volume). The Logical view separates from the physical layer : put N physical disks (or physical partitions) in M logical volumes, and use/partition those logical volumes as you need – Olivier Dulac Dec 12 '16 at 12:51
3

Well,

If you want to "merge" the drives into one contiguous filesystem, the answer above with LVM is probably the best answer, though I would be very cautious doing that. The considerations noted above are very real. (e.g. the loss of one drive could make the data on all drives irretrievable.)

Depending on your usage of the 3 drives, I would think it would be best to go and get a 4TB hard drive and copy all the partitions from the other 3 drives onto it with a utility like "(g)parted" or "dd/ddrescue". This way, you still maintain the original drives should anything go wrong.

Now, if one or more of the 3 drives is a system's root partition (e.g. one or more hard drives is a system's OS drive that you will want to boot to after the "merge" operation), I would look at another way to do it, or set up the 4TB drive to boot the OS partition(s) via grub.

HTH.

2

The following can do what you want (also search for "union filsystems"):

  1. mergerfs
  2. OverlayFS
  3. LVM
  4. unionfs
  5. aufs

There are others but these are or were popular at one time. LVM is dangerous because loss of a drive will destroy the whole filesystem. unionfs doesn't seem to be developed any more. Aufs is complicated and requires compiling kernel stuff. overlayfs has CoW modes and is built in to modern kernels so it's easily available on almost every system and is popular for container style virtual machines (eg. Docker). However, overlayfs has some limitations compared to a normal filesystem. mergerfs uses FUSE so can run in user space and acts like a normal filesystem. Of these choices I would recommend mergerfs or overlayfs depending on your needs.

Concatenating filesystems like this can be useful because it allows the underlying filesystems to be separate entities. This can under certain workloads actually provide more performance than a typical RAID array because it can reduce random access activity (eg. 10 clients accessing 10 separate drives). Failure of individual drives won't lose all the data on all drives. You can also combine a union filesystem with something like SnapRAID to get backup/redundancy.

  • Thanks for pointing out mergerfs. I’m looking for a way to merge 2 500GB USB-Disks to a single logical structure (lot’s of 3D image data). I will try this first. – Peter Oct 16 '18 at 8:01
1

The other answers provide answers to your question. However your need may be better met by RAID.

  • combining both 250GB drives into a software raid1, giving you 250 GB (~228 GB effectively) of redundant storage for the data you care about. This could be your OS, and your personal files. Then use the single 3TB drive as a /data store, knowing that it is less-protected.

  • Purchase a second 3TB drive and raid1 the two big drives, giving you 2.6TB effective storage, but protected against failure of a single drive. Can combine with raid1 of the two 250 GB drives for a fully redundant system / data separation. Best idea if you can afford it.

  • Raid5 over the three drives, giving effective storage of ~500GB and wasting most of the 3TB drive. Wasteful

  • JBOD / linear raid This will give the full 3.5TB (about 3.1 TB effectively) but failure of any drive will dump the entire contents of the whole filesystem. This is bad - don't do it - only mentioned for completeness.

Do note that NONE of these suggestions replace a proper backup routine. Raid protects against drive failure, not file deletion or loss by burglary or fire.

LVM on top is another layer up the abstraction tree - and will achieve similar goals but without the resiliency of raid.

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.