I want to switch my current working partition to an existent one on the disk under CentOS. How to achieve this ?

PS : i want to switch to the larger partition (/dev/sdc or /dev/sdb/cl-home) (currently i am using KVM and others on /dev/sdb3/cl-root) so that i can install KVM and many VMs, is it possible ? Btw parted says /dev/sda is selected while i'm on /dev/sdb/cl-root

Or maybe to achieve that, should i mount the /dev/sdb3/cl-home at the "/" mountpoint ? EDIT : should i try to create a partition after selecting /dev/sdc (or /dev/sdb/sdb3/cl-home) disk with gparted like so :

(parted) select /dev/sdc

Please see attached partitions on my disk. e Thanks.

  • 2
    Please don't post screenshots of text. It is not accessible to some readers. Post the text instead. – Michael Hampton Sep 24 '20 at 19:01

Or maybe to achieve that, should i mount the /dev/sdb3/cl-home at the "/" mountpoint ?

No, that will make the system unusable. OS and mount points are installed at / ("rootfs"). Just because the system has certain volumes allocated doesn't mean you have to use them, as sysadmin you can rearrange storage.

You already have Linux LVM, which has useful features. Use logical volumes, not partitions.

Get the status of PVs, VGs, and LVs: pvs; vgs; lvs;

From the lsblk output we can infer that VG cl spans sdb3 and sdc1. Not ideal: requires both disks to be online for the VG to function, and performance will be uneven across the PVs as one also stores /.

Check how much space /home is actually using with df -h /home. It might be much less than its 380G size, given the installer's habit of giving the remainder to /home.

First of all, make a backup and test restoring it.

Regarding storing your VM guest data, create new LVs on new VGs. This separates the data from the OS install, allowing the disks to be moved independently.

# Get unique IDs for your disks, and determine which are in use.  
# Unique IDs prevent problems if the device letter (/dev/sdd for example) changed.
ls -l /dev/disk/by-id/wwn*
# Create a new data VG on empty disks. Your disk names will be different.  
# Note the use of the entire disk, partitions are not necessary
vgcreate data /dev/disk/by-id/wwn-0x60022480bd6bef1caf06ed2a65b007c4
# Create a LV
lvcreate --name vm --size 100g data
# Create a file system. 
mkfs.xfs -L vm /dev/data/vm
# Edit /etc/fstab to mount /dev/data/vm  on  /srv
# Your mount point probably will be different 

Optionally, determine how you might safely remove /dev/sdc1 from cl. Some file systems cannot be reduced, this may require a backup, reduce the LV, and restore. And finally, pvmove and vgreduce.

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.