You are not logged in.

#1 2020-04-09 16:35:49

akjanik
Member
Registered: 2017-11-13
Posts: 23

Merging different partition to lvm on the same physical disk

This is my current setup:

[root@adam adam]# pvscan
  PV /dev/sdb5   VG archvol         lvm2 [<121.29 GiB / 0    free]
  Total: 1 [<121.29 GiB] / in use: 1 [<121.29 GiB] / in no VG: 0 [0   ]
[root@adam adam]# lvscan
  ACTIVE            '/dev/archvol/root' [40.00 GiB] inherit
  ACTIVE            '/dev/archvol/swap' [12.00 GiB] inherit
  ACTIVE            '/dev/archvol/home' [<69.29 GiB] inherit
[root@adam adam]# 

I used to run dual boot on this, with Windows OS on the same disk:

[root@adam adam]# fdisk -l
...
Device         Start       End   Sectors   Size Type
/dev/sdb1       2048   1023999   1021952   499M Windows recovery environment
/dev/sdb2    1024000   1226751    202752    99M EFI System
/dev/sdb3    1226752   1259519     32768    16M Microsoft reserved
/dev/sdb4    1259520 245759999 244500480 116.6G Microsoft basic data
/dev/sdb5  245760000 500118158 254358159 121.3G Linux LVM
...

Disk /dev/mapper/archvol-root: 40 GiB, 42949672960 bytes, 83886080 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/archvol-swap: 12 GiB, 12884901888 bytes, 25165824 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/archvol-home: 69.29 GiB, 74394370048 bytes, 145301504 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

I do not use Windows OS on this disk anymore and don't need it, so I would like to merge Microsoft partition (especially big one - /dev/sdb4    1259520 245759999 244500480 116.6G Microsoft basic data) - into /dev/sdb5. And I would like to do it safely (already backed up sensitive data)
I'm not sure how to do this exactly. From my understanding, I should start with mkfsing unwanted partitions for example

mkfs.ext4 /dev/sdb4
mkfs.ext4 /dev/sdb3
mkfs.ext4 /dev/sdb1

But then what? Should I merge them into sdb5 one with tool like gparted? Let's say it will create one big /dev/sdb7. Will I be able then do

pvcreate /dev/sdb7
vgextend archvol /dev/sdb7
lvextend -L+40G /dev/archvol/root
lvextend -l +100%FREE /dev/archvol/home

and is it supposed to work? Or maybe there is other way, simpler or more correct one?

I wonder if i could just merge sdb(1/3/4) into sdb/5, I was looking for something like `pvextend` but didn't find.

Offline

Board footer

Powered by FluxBB