fstransform icon indicating copy to clipboard operation
fstransform copied to clipboard

xattrs are not copied

Open rzlourenco opened this issue 5 years ago • 3 comments

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?

rzlourenco avatar May 31 '20 10:05 rzlourenco

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'

cosmos72 avatar May 31 '20 11:05 cosmos72

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

YihaoPeng avatar Dec 19 '20 12:12 YihaoPeng

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:

  • immutable files cannot be deleted or truncated: the immutable xattr must be removed first
  • append-only files may not be truncated: append-only xattr must be removed first

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.

cosmos72 avatar Apr 17 '21 15:04 cosmos72