2

its quite possible I didn't understand what I was doing when I set it up, but...

OK, I bought three 2TB drives that I wanted to use for media storage. I didn't want to deal with figuring out which files to put in which drive, so I Googled "how to span disks" and discovered lvm. Fine, easy enough... so now I have one 6TB "drive" mounted as a ext4 filesystem at /mnt/bigdisk

Everything seems fine, but as I'm now approaching 2TB usage, I started to wonder the following:

1) How is the data being allocated? Does each drive now have 1/3 of 2TB? Or is one almost full? How can I see it?

2) What happens when one (or more) disk is getting near the limit and I add a file large enough that it has to cross disks? An error, or does it just "handle it"?

Thanks.

bcsteeve
  • 1,299

1 Answers1

2

It depends on how you set it up. The default is to fill one up and then the next, which is handled transparently. When creating a logical volume with lvcreate, you can specify the --stripes nn flag to stripe the data across nn drives. This allows faster access to data since it is simultaneously accessed on all drives in parallel. You can see the current layout with lvdisplay -m and if you want to change it to striped, you can use lvconvert --stripes 3 vg/lv where vg and lv are the names of the volume group and logical volume. This can take a long time if you allocated all of the space to the volume already. Also for media storage, speed isn't really important and if you want the drives to be able to spin down to save power, then leaving it not striped may be better since only the drive that has the data you are accessing will need to wake up instead of all 3.

As for how to see how much space is used on each disk, there is not a good way of doing that.

psusi
  • 38,031