Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a network storage server running Debian, containing multiple hard drives. These drives are all mounted into subdirectories of a samba-shared folder. All members of the network have full read and write access.

The problem in this setup is the lack of flexibility. The files are stored directly in one folder, and once a drive is full users have to create a new folder on another HDD.

What is possibly the best solution to get the space distributed dynamically? This is with what I've come up this far:

  • RAID 0: since every failure of a single HDD would result in massive loss of data, striping is not an option
  • RAID 1: my intention is to re-use old HDDs of different sizes, so this is not working either
  • RAID 5: same as above, won't work because of different HDD sizes
  • LVM: quite cool, since it is extensible, but is there an option to prevent striping? If not, the failure of a single disk would lead to the loss off all files stored partially on this particular disk...
  • btrfs: subvolume management is nice, but can a single folder span multiple volumes?

Basically, I am looking for an LVM-like system with no striping, or at least the possibility to move all multi-volume-files manually (cron job, etc.) back to a single volume.

share|improve this question

1 Answer 1

You can get an effective RAID substitute directly in Linux LVM, without mdadm or an a hardware RAID controller. That allows you to use differently sized disks as well.

You can't avoid striping, but will have redundant stripes, so a single disk failure won't lose you any data.

Simply initialize all disks as LVM physical volumes, assign them to the same volume group and use the correct flags when setting up logical volumes.

-m, --mirrors Mirrors Creates a mirrored logical volume with Mirrors copies. For example, specifying -m1 would result in a mirror with two-sides; that is, a linear volume plus one copy.

So for example the commandline lvcreate -m1 -L 10G -n <name> <volume_group> would create a mirrored logical volume or the equivalent of a RAID1 array.

-i, --stripes Stripes Gives the number of stripes. This is equal to the number of physical volumes to scatter the logical volume. When creating a RAID 4/5/6 logical volume, the extra devices which are necessary for parity are internally accounted for. Specifying -i3 would use 3 devices for striped logical volumes, 4 devices for RAID 4/5, and 5 devices for RAID 6.

If you have three disks 2 would be the maximum number of stripes (the third is for parity) and lvcreate --type raid5 -i2 -L 20G -n <name> <volume_group> would set up the equivalent of three disk RAID5 array.

When you your file system fills and you can add a single additional disk and extend the LVM and filesystem without manually creating new directories and shuffling data around.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.