cosmos72 / fstransform

tool for in-place filesystem conversion (for example from jfs/xfs/reiser to ext2/ext3/ext4) without backup
GNU General Public License v2.0
270 stars 29 forks source link

xattrs are not copied #29

Open rzlourenco opened 4 years ago

rzlourenco commented 4 years ago

First of all, thank you! Very handy tool. I am attempting to convert from XFS to ext4 (to allow shrinking) and noticed that xattrs are not preserved. What are your thoughts on this matter?

cosmos72 commented 4 years ago

I have never used xattrs, and fstransform does not copy them... It's surely worth adding, in the next weeks I will try to extract the relevant from GNU 'cp'

YihaoPeng commented 3 years ago

There is another problem here, xattr +i will prevent the file from moving, thus interrupting the conversion.

Like this:

09:32:18 fsmove: progress: 1.9% done, 110.6 gigabytes still to move
09:32:34 fsmove: progress: 3.8% done, 108.5 gigabytes still to move, estimated 10 minutes left
09:32:36 fsmove: ERROR: failed to open source file `/tmp/fstransform.mount.14309/var/lib/deepin/deepin_security_verify.whitelist': Operation not permitted

09:32:36 ERROR! fstransform: command '/usr/sbin/fsmove -- /tmp/fstransform.mount.14309 /tmp/fstransform.loop.14309 --exclude /tmp/fstransform.mount.14309/.fstransform.loop.14309' failed (exit status 255)
                this is potentially a problem.
                you can either quit now by pressing ENTER or CTRL+C,

                or, if you know what went wrong, you can fix it yourself,
                then manually run the command '/usr/sbin/fsmove -- /tmp/fstransform.mount.14309 /tmp/fstransform.loop.14309 --exclude /tmp/fstransform.mount.14309/.fstransform.loop.14309'
                (or something equivalent)
                and finally resume this script by typing CONTINUE and pressing ENTER: CONTINUE
10:33:21 fstransform: unmounting and running '/usr/sbin/fsck' (disk check) on loop file '/tmp/fstransform.mount.14309/.fstransform.loop.14309'
10:33:22 fsck: fsck from util-linux 2.33.1

I have to run the following command to continue:

sudo chattr -i /tmp/fstransform.mount.14309/var/lib/deepin/deepin_security_verify.whitelist
sudo rm /tmp/fstransform.loop.14309/var/lib/deepin/deepin_security_verify.whitelist
sudo /usr/sbin/fsmove -f -- /tmp/fstransform.mount.14309 /tmp/fstransform.loop.14309 --exclude /tmp/fstransform.mount.14309/.fstransform.loop.14309
cosmos72 commented 3 years ago

Commit c1bd8c59342ade582485e4b124f5020f5c5b6f87 adds initial support to copy xattrs using ioctl(FS_IOC_FSSETXATTR)

Among other things, it correctly manages both xattr +i (immutable) and xattr +a (append-only), which must be handled specially because:

Truncate is required if filesystem is almost full: fsmove copies the file backward and progressively truncates it to preserve space.

It does not yet manage xattrs on directories.