How to repartition XFS filesystem

Hi all, I am in one issue. our Linux system is using Logical volume and formatted with XFS filesystem. It’s not allowing to shrink the partition. (Used lvreduce ) I need to make some free space and repartition the OS. Which is the best procedure for repartitioning? I could see that backup and restore ( using xfsdump) to new partition as the only solution. This may not work for us as the size is huge.

xfs doesn’t support shrinking. So you cannot do that. You would have to backup the data from the disk and restore it to a new partition. You don’t even need xfsdump for this, rsync can be used to copy the data to a new external disk (usb) and back to the new partition, or network server via NFS for example.

A volume on remote system that is mounted to local system (via NFS, etc) is still copied “locally”,
but rsync can also (and was probably primarily written for) copy over network with both SSH and rsync protocols (i.e. without “mount”).

If data (files, not the partition) is so “huge” that you can’t store a copy of it anywhere else, then you obviously can’t/don’t have any backup of it. Isn’t data that does not deserve a backup essentially expendable?

In other words, if you have valuable data, then you should also have backups. Backups are also convenient if one has to repartition, or say install new version of OS.

Hi iwalker. Thank you for the swift response. :slight_smile:

1 Like

Thank you jlehtone. I also was thinking the same, if backup and restore is the only option. I may consider backing up only required folders/files. here my main challenge is that, I may not get a different disk. Need to work with single disk for partitioning and backup.

You can look at:

lsblk --fs

and du -d1 -h . at mount-point / under whatever the directories of interest are
to see whether you have room to stash the valuables in.

This is OK for temporary data migration, but if the disk fails, you will lose everything. A true backup should be stored in a separate location from it’s original source and certainly not on the same disk.

1 Like

Thank you iwalker, I dont have other options.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.