backup , restore shrink xfs filesystem.
xfs is highly scalable filesystem introduced in redhat 7 release as default filesystem.
Due to its scalability feature, unlike ext3,4 filesystem you cannot shrink or reduce xfs filesystem.
instead it can be grown / extend online quickly using xfs_growfs command.
xfs ships with a backup and restore utility also which helps to backup any xfs formated mount points such as /home or /var very easily. Restore is also very easy.
So where you cannot directly reduce the size or shrink xfs filesystem. you can use the xfs builtin backup restore feature to backup data delete,reduce partition and then restore data back. ( In case of bigger data volume this may be a challange, use in your own risk)
in my example i wants my partition to be shrink is /home
Install utility if you dont have
# yum install xfsdump
Backup :
# xfsdump -l 0 -f /home.img /dev/myvg/lvhome
in above -l is level of backup 0 means full backup. this will backup lvhome logical volume in an image /home.img
now i will unmount my /home and will re-create lvm LV
# umount /home
# lvremove /dev/myvg/lvhome
# lvcreate -n home -L 3G myvg
# mkfs.xfs /dev/myvg/lvhome
Now mount and restore your data back
# mount /dev/myvg/lvhome
# xfsrestore -f /home.img /home
And All Done!
Due to its scalability feature, unlike ext3,4 filesystem you cannot shrink or reduce xfs filesystem.
instead it can be grown / extend online quickly using xfs_growfs command.
xfs ships with a backup and restore utility also which helps to backup any xfs formated mount points such as /home or /var very easily. Restore is also very easy.
So where you cannot directly reduce the size or shrink xfs filesystem. you can use the xfs builtin backup restore feature to backup data delete,reduce partition and then restore data back. ( In case of bigger data volume this may be a challange, use in your own risk)
in my example i wants my partition to be shrink is /home
Install utility if you dont have
# yum install xfsdump
Backup :
# xfsdump -l 0 -f /home.img /dev/myvg/lvhome
in above -l is level of backup 0 means full backup. this will backup lvhome logical volume in an image /home.img
now i will unmount my /home and will re-create lvm LV
# umount /home
# lvremove /dev/myvg/lvhome
# lvcreate -n home -L 3G myvg
# mkfs.xfs /dev/myvg/lvhome
Now mount and restore your data back
# mount /dev/myvg/lvhome
# xfsrestore -f /home.img /home
And All Done!
Comments
Post a Comment