0

I have got 4 6TB HDD's, each is divided into 5 partitions: 1) ESP - 250mb 2) raid - rootfs 14gb raid1 3) swap - 5gb 4) raid - 70gb raid1 LVM's for VM's 5) raid - 16tb raid5 LVM for storage

And question is regarding (5). After creating raid5 (mdadm), PV & Vg was made, and on top LVM (whole 16TB). Afterwards KVM and first VM was installed (on lvm from (4) and this 16TB LVM (5) was assigned to it. So the one big 16TB partition (sda1) was created inside and it was formatted to ext4.

Here comes trouble: I wanted to reduce LVM size on host machine, but no luck... I know that sda1 shouldn't be created, but it is too late now. What steps should be done to shrink this LVM on host machine? Probably VM's filesystem->shrink VM's partition sda1-> somehow reduce sda size-> and finally shrink LVM that is on host machine, so that new LVM would fit there?

I hope that it is clear that Data must stay untouched :) There is like 10TB of data at the moment.

GregorPL
  • 1
  • 1
  • not very clear to me. sorry. please post some lvm outputs, and try to read & understand your post as if you knew nothing about the setup. – Chaoxiang N Jan 15 '19 at 08:01
  • I am unable to paste complete output here, so please have a look here: [https://pastebin.com/W2drgb72](https://pastebin.com/W2drgb72) And the task is to shrink 16TB LVM, with underlying partitions and FS (/dev/sda1 -> /bigdata). – GregorPL Jan 18 '19 at 00:46

1 Answers1

0

first bear in mind that you have a debianVM4 16TB ext4 filesystem on top of a 16TB block device /dev/sda1 (which is backed by a 16TB lvm volume in debianKVM)

  • on debianVM4, umount /bigdata, and use resize2fs to shrink the ext4 filesystem layer to around 11TB

  • on debianVM4, use parted resizepart command to reduce sda1 to around 11.2TB (Warning the size must be greater than the size of the previously shrinked filesystem)

  • shutdown debianVM4

  • on debianKVM, use lvreduce to shrink /dev/vg1/dataDisk to around 11.5TB (Warning the size must be greater than the size of the previously shrinked partition)

  • boot debianVM4, /dev/sda is now around 11.5TB in size, and /dev/sda1 is still around 11.2TB

  • on debianVM4, umount /bigdata

  • on debianVM4, use parted resizepart to increase /dev/sda1 to max avail size (11.2TB to 11.5TB)

  • on debianVM4, mount /bigdata

  • on debianVM4, use resize2fs to grow /bigdata to the total size of /dev/sda1

Chaoxiang N
  • 1,283
  • 5
  • 11