Wednesday, October 8, 2014

Shrink an XFS partition

To shrink an XFS partition, follow these steps:

1. First, backup the data using xfsdump (-f stands for where to save the dump file and the /home stands for which mount to backup):
xfsdump -f /tmp/home.dump /home
2. Unmount the partition:
cd / 
umount /home
3. Delete the partition:
lvremove /dev/vg00/home
4. Recreate it with a smaller size:
lvcreate --name home -L 2GB vg00
5. Mount the /home partition:
mount /dev/vg00/home /home
6. Restore the data using xfsrestore:
xfsrestore -f /tmp/home.dump /home

No comments:

Post a Comment