Split file system
The scenario is: You have one server with LVM and with one large disk, you need split the file system between operating systemvg and appvg, but the problem is that you are using xfs, you can't reduce the file system.
This draft only covers the migration of operating system, you must migrate all app data as you prefer.
Pre requisites
- For this task disable SELinux.
- Two extra disks for systemvg (operating system) and appvg (application files)
- rsync
Procedure
Use fdisk to create /boot partition and PV for operating system.
fdisk /dev/vdb n p 1 +1G n p 2 enter w
Create file system and temporal mount points:
mkfs.ext4 /dev/vdb1 pvcreate /dev/vdb2 vgcreate rootvg /dev/vdb2 lvcreate -L2G -n swap rootvg mkswap /dev/mapper/rootvg-swap lvcreate -l16G -n root rootvg mkfs.ext4 /dev/mapper/rootvg-root mkdir /mnt/roottmp mount /dev/mapper/rootvg-root /mnt/roottmp mkdir /mnt/roottmp/boot mount /dev/vdb1 /mnt/roottmp/boot
Copy all information with rsync, you must change or add app directory in exclude argument:
rsync -aAXv /boot/* /mnt/roottmp/boot rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/boot/*","/app/*"} /mnt/roottmp blkid /dev/vdb1
Update /mnt/roottmp/etc/fstab, you must change /boot UUID, and mount point names and file system type
Update /mnt/roottmp/boot/grub2/grub.cfg, same as above.
Mount tmpfs and make a chroot, install grub and update initramfs.
for i in /dev /proc /sys /run; do mount -B $i /mnt/roottmp$i; done chroot /mnt/roottmp grub2-install --recheck /dev/vdb dracut -f -v
Reboot!