0

I have disk space allocated in one of my machine in below way.As you can see , it has two disks : sda and sdb

Root LVM - vg01-lv_root - has 445.6G size ( sda )

Home LVM - vg02-lv_home - has 893.7G size (sdb)

I want to cut off : 400GB from Root LVM and add it to Home LVM

Can someone please let me know if its possible and how to achieve this?

At Present

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 893.8G 0 disk ├─sda1 8:1 0 512M 0 part /boot └─sda2 8:2 0 893.3G 0 part ├─vg01-lv_swap (dm-0) 253:0 0 89.9G 0 lvm [SWAP] ├─vg01-lv_root (dm-1) 253:1 0 445.6G 0 lvm / ├─vg01-lv_var (dm-3) 253:3 0 178.9G 0 lvm /var └─vg01-lv_usr (dm-4) 253:4 0 178.9G 0 lvm /usr sdb 8:16 0 893.8G 0 disk └─sdb1 8:17 0 893.8G 0 part └─vg02-lv_home (dm-2) 253:2 0 893.7G 0 lvm /home 

Desired

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 893.8G 0 disk ├─sda1 8:1 0 512M 0 part /boot └─sda2 8:2 0 893.3G 0 part ├─vg01-lv_swap (dm-0) 253:0 0 89.9G 0 lvm [SWAP] ├─vg01-lv_root (dm-1) 253:1 0 45.6G 0 lvm / ├─vg01-lv_var (dm-3) 253:3 0 178.9G 0 lvm /var └─vg01-lv_usr (dm-4) 253:4 0 178.9G 0 lvm /usr sdb 8:16 0 893.8G 0 disk └─sdb1 8:17 0 893.8G 0 part └─vg02-lv_home (dm-2) 253:2 0 1293.7G 0 lvm /home 

Thanks,

Manoj Kumar

1 Answer 1

1

short answer: you can't

long answer:

data to be freed is inside another disk on another vg.

you would theorically have to:

  1. shrink filesystem / this is done by umounting / (booting on a live disk, use fsck , resize2fs ) this is the hardest part.
  2. shrink logical volume ( lvredure --size -400G lv_root ), you now have 400 Gb free on vg01 (more likely free space is between lv_root and lv_var )
  3. move vg01's data to bottom of sda2 (pvmove --alloc x lv_var and pvmove --alloc x lv_usr ), you'll have to find x. I am not sure this can be done.
  4. use pvresize to free 400 Gb
  5. break partitionning of sda to recreate sda2 and create a sda3 with 400 Gb freed above (fdisk )

Now, things come easy

  1. create a new physical disk (pvcreate /dev/sda3 )
  2. extend vg02 ( vgextend vg02 /dev/sda3 )
  3. extend lv_home ( lvextend +400 Gb lv_home )
  4. resize /home ( resize2fs /home )

Do not follow thoses steps if you don't understand them.

Step 1. 2. and 3. are very likely to break system.

Step 4. and 5. are risky but doable.


It would be more easy to have a planned rebuild system (rather than emergency have breaking / )

1
  • Absolutely. The primary mistake was over-allocating space to LVs and their associated filesystems in the first place. Commented Sep 6, 2023 at 15:11

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.