Split disk with operating system installation of application files with XFS

Posted on

Usually you can make backups with dd to get a accurate image of your operating system. Some times servers have application and operating system in the same disk or file system.

XFS doesn't allow reduce file system and dd only backup (easily) entire disks, we need separate operating system to a small disk and application to it's own disk and file system.

In our case we have Alfresco installed on /srv, so we need to separate / of /srv.

We also will change the file system to ext4, that allows to reduce file systems for future requirements.

This was tested on VMWare virtual machine.


sda -> original large XFS
sdb-> new rootvg (operating system)
sdc-> new appvg (application files)


  1. Present two disks, sdb to rootvg (operating system) and sdc to application files.
  2. SELinux disabled
  3. rsync

Use fdisk to create /boot partition and PV for operating system.

fdisk /dev/sdb

Create file system and temporal mount points:

mkfs.ext4 /dev/sdb1
pvcreate /dev/sdb2
vgcreate rootvg /dev/sdb2
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/sdb1 /mnt/roottmp/boot

Copy all information with rsync, you must change or add app directory in exclude argument, in our case /srv:

rsync -aAXv /boot/* /mnt/roottmp/boot
rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/boot/*","/srv/*"} /mnt/roottmp
blkid /dev/sdb1

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, you must change UUIDs.

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

Power off virtual machine and remove sda disk.

Reboot and enjoy!