Recreating an XFS file system with `ftype=1`
I have a CentOS 7 system where the root file system is XFS (created with ftype=0
, the default CentOS setting at the time the system was installed). Unfortunately, the Docker overlay2
storage driver requires that file system to have been created with ftype=1
:
https://docs.docker.com/storage/storagedriver/overlayfs-driver/#prerequisites
So now I'd like to recreate the root FS with ftype=1
. I was thinking of doing that as follows:
- Boot into a rescue image of some sort.
-
xfsdump
the root FS to a remote location. - Recreate the root FS with
ftype=1
. -
xfsrestore
the root FS from the remote dump.
One thing I'm not sure about, though, is whether the xfsdump
output carries anything related to the ftype
setting. That is, would there be any issues doing the xfsrestore
onto an XFS file system with a different ftype
setting?
Or is there a better approach to solving this specific problem (that doesn't involve reinstalling the whole system, repartitioning, etc.)?
My proposed method seemed to work fine. Here's my procedure:
- Boot into
CentOS-7-x86_64-LiveGNOME-1804.iso
. - Open a terminal and
sudo -s
. - Scan for LVM volumes:
vgscan
- Change into the appropriate volume group (
centos
in my case):vgchange -ay centos
- Scan for the logical volumes in that group:
lvscan
- Create a mount point for the root FS:
mkdir /mnt/root
- Mount the logical volume corresponding to the root FS:
mount /dev/centos/root /mnt/root
- Dump to remote host:
xfsdump -J - /mnt/root | ssh <host> 'cat >/data/rootfs.dump'
- Unmount the root FS:
umount /mnt/root
- Recreate the root FS:
mkfs.xfs -f -n ftype=1 /dev/centos/root
- Mount the recreated root FS:
mount /dev/centos/root /mnt/root
- Restore from remote host:
ssh <host> 'cat /data/rootfs.dump' | xfsrestore -J - /mnt/root
- Reboot. Everything should be as it was before, except
xfs_info /
should now showftype=1
.
Note: My xfsdump
call resulted in a number of warnings of the form
xfsdump: WARNING: failed to get bulkstat information for inode 10485897
According to someone who appears to be an XFS developer (http://xfs.9218.n7.nabble.com/xfs-and-lvm-snapshots-tp1241p1246.html):
They can be ignored - they are inodes that were previously unlinked, but are still partially there on the snapshot volume, and visible to the by-handle interfaces that xfsdump is using to extract all of the inodes in the snapshot.