1

I have an LVM mirror made of 6 disks of 1Tb. I've made a RAID 1 mirror with 3+3 disks. The logical volume and the partition on it have therefore 3Tb of usable space. Running out of disk space, I'm trying to cook a temporary solution with an extra 4Tb disk that I added to the latest available slot in this computer.

I would like to extend my current filesystem with these extra 4Tb for a grand total of 3+4= 7 Tb. Therefore, one part of the logical volume would have a RAID 1 mirror and the other part a single disk (as I said it's a temporary solution).

I can't reformat my existing RAID1 array or move the data as I'm really running out of space everywhere.

I did:

vgextend vg0 /dev/sdg1

where vg0 is my volume group with the 6 disks and sdg1 is the new 4Tb disk. Then I did:

lvextend -l +100%FREE /dev/vg0/data

where /dev/vg0/data is my logical volume.

However, the logical volume cannot be extended and lvextend tells me:

Found fewer allocatable extents for logical volume data than requested: using 715395 extents (reduced by 953862).

In the end, the volume group has a size of approx. 10Tb which is correct but the logical volume stays at 3 Tb.

The current logical volume is as follow:

    Using logical volume(s) on command line.
  --- Logical volume ---
  LV Path                /dev/vg0/data
  LV Name                data
  VG Name                vg0
  LV UUID                xcd11P-sL1W-M9vK-XftB-OeAA-b0Ec-AM2btA
  LV Write Access        read/write
  LV Creation host, time xxxxxxx, 2015-08-27 18:24:58 +0100
  LV Status              available
  # open                 1
  LV Size                2.73 TiB
  Current LE             715395
  Mirrored volumes       6
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     1536
  Block device           253:12

And the desired configuration will be as follow, where I would of course partly loose the redundancy of a full RAID 1 configuration. But it's a temporary solution. And of course, in the future, ZFS or btrfs would be a better solution:

a strange lvm configuration

Any idea on how to solve this specific problem (if a solution exists) ?

  • 1
    Could you please update your original post with the output of command lvdisplay -v /dev/vg0/data you can delete the duplicate looking lines towards the bottom, leaving few in place. – MelBurslan May 16 '16 at 14:01
  • Is that organised as a RAID-0 containing 3 x 1TB RAID-1 arrays (i.e. 3 mirrored pairs, or RAID-10 aka RAID 1+0), or a RAID-1 array of 2 x 3TB RAID-0 arrays (i.e. 1 mirrored pair, or RAID 0+1)? The former (RAID-10) is fairly easy to expand, the latter (RAID 0+1)....not so easy, and far less safe than RAID-10. RAID 0+1 should be avoided. See serverfault.com/questions/145319/…. If you're using RAID 0+1 then ignore my suggestion to pull one of ther drives, your data is ALREADY at significant risk, pulling a drive will (cont) – cas May 17 '16 at 8:46
  • (cont) reduce your array to RAID-0 (i.e. completely unsafe, no redundancy at all). You really do not want to continue using RAID 0+1 - as a matter of urgency you need to move all your data ASAP to at least a 2x4TB RAID-1 (or zfs or btrfs) array....but (unless you have an eSATA or USB external drive box you can use) it's going to be harder than in my answer because you can not afford to risk removing even one of those drives. – cas May 17 '16 at 8:49
1

Adding a single 4TB drive to your multi-mirror array destroys any ability to trust in the redundancy that RAID is supposed to provide. It would be safe if you could add a second 4TB drive, but (as you have no spare drive ports) you can't do that without removing one of the existing disks.

If I were you, I'd remove one of the mirror disks, add a second 4TB drive, and create a new volume group with 2x4TB drives in a RAID1 mirror.

NOTE: This will leave one of your 1TB RAID-1 pairs without its mirror, so you will be at risk of data loss until the rsync has completed. If you have ANY extra ports at all, even e-sata or USB, put the 1TB drive you removed onto that port until the rsync is finished.

Then rsync ALL of the data from the old volume group (the bulk of the rsync can be done while the system is in use, but you'll have to do a final rsync in single-user mode or from a rescue CD/USB. In fact you can run rsync repeatedly while the system is in use, until you can schedule some downtime for the final rsync and the next stage).

When you've rsync-ed the data, shutdown the system and remove the old 1TB drives or, better yet, re-use 4 of them to add another 2 RAID-1 mirrors to your new volume group (2x1TB each). This will result in a volume group of 6TB (4TB + 1TB + 1TB).

6TB is less than the 7TB you were planning, but at least you actually have Redundancy (the R in RAID) for all your data.

Alternatively, just replace one of the 1TB RAID-1 pairs with 2 x 4TB drives (one at a time, of course) - same end result, without the rsyncing. The rsync idea is probably more useful if you decide to go with the btrfs or zfs suggestion below.

Later, you can replace 1 or both of the (remaining) 1TB mirrors with more 4TB mirrors.


One alternative worth considering is to create the 4TB mirror using ZFS or btrfs instead of LVM. This will give you the benefits of an error-correcting, copy-on-write filesystem with compression, snapshots, rollbacks, easy sub-volume creation, "soft" quotas and reservations (rather than the "hard" pre-allocation of space that LVM gives you), zfs/btrfs send & receive for backup (to another zfs/btrfs pool or server), and more.

Either ZFS or btrfs would make it trivially easy to replace 1TB drives with larger drives. Just swap the old drives for the new one at a time and tell btrfs/zfs to replace the missing drive with the new.

BTW, if you're using LVM to provide LV partitions to VMs rather than (or as well as) mounted filesystems, btrfs is not an option (unless you're willing to switch to qcow2 or raw or other disk-image files). ZFS is, as you can create ZVOLs as well as ZFS filesystems.

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.