I need the space of sda on either / or a specific mount like /data. How can I repartition / change the current layout to match the needed desire?

sda 8:0 0 2.7T 0 disk ├─sda1 8:1 0 1M 0 part ├─sda2 8:2 0 1G 0 part /boot └─sda3 8:3 0 2.7T 0 part ├─centos_hosted--by-root 253:0 0 50G 0 lvm / ├─centos_hosted--by-swap 253:1 0 15.8G 0 lvm [SWAP] └─centos_hosted--by-home 253:2 0 2.7T 0 lvm /home


/dev/mapper/centos_hosted--by-root /                       xfs     defaults        0 0
UUID=428e7c4c-d50a-45cc-ac2e-ab7f21e39a69 /boot            xfs     defaults        0 0
/dev/mapper/centos_hosted--by-home /home                   xfs     defaults        0 0
/dev/mapper/centos_hosted--by-swap swap                    swap    defaults        0 0

The partition should be ext4. /home is empty so it wouldn't care if it has to be wiped.
Is it possible to archieve it without reinstalling the whole server?

  • Why does it have to be a new partition and specifically ext4-formatted? Can't you just shrink an existing filesystem, lvreduce the LV it's on, then lvextend -r the existing / LV? – n.st Nov 29 '18 at 15:31
  • Oh, scratch the "shrink" part: XFS cannot be shrunk. Still, delete /home and extend / without creating a new partition? – n.st Nov 29 '18 at 15:33
  • @n.st, my understanding is OP want ext4 filesystem. And root is xfs – Romeo Ninov Nov 29 '18 at 21:00
  • @RomeoNinov I understand they want ext4, but I'd like to know why. Not to be rude, but from the question I get the impression that OP doesn't know much about the differences between filesystems, so they might be asking for ext4 without a technical reason. – n.st Nov 29 '18 at 23:13

THe process is sample (if /home is fine to be destroyed) Exec following commands (as root)

umount /home
lvremove /dev/mapper/centos_hosted--by-home
#if the name of volume group is centos_hosted--by
lvcreate -n centos_hosted--by-data -L 100G centos_hosted--by 
mkfs.ext4 /dev/mapper/centos_hosted--by-data
mkdir -p /data
mount /dev/mapper/centos_hosted--by-data /data

Edit /etc/fstab and replace /home with /data and centos_hosted--by-home with centos_hosted--by-data. Also change xfs in this line with ext4

If you want to see the name of volume group exec command vgs

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.