On Tue, Nov 05, 2024 at 12:11:24AM +0100, Thorsten Glaser wrote:

>       if [[ $dat = *"$nl"'Filesystem revision #:'*([   ])0* ]]; then
>               let ++p
>               print -ru2 "W: $vis has Y2038 problem and is a revision 0 
> filesystem"
>               print -ru2 'N: you must recreate it as revision 1 filesystem 
> with 256-byte inodes; see:'
>               print -ru2 'N: 
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1086603#31'
>               continue
>       fi

So technically, it *is* possible to convert a rev 0 file system to rev
1.  We never automated it because this change happened in 1996, and
back then, hard drives were doubling in size every 18 months, and by
the time HDD's had gotten large enough that you really want a rev 1
file system, it's very likely that the HDD would have died.  So, we
never bothered.

But if you want to convert such a file system, you can do this:

debugfs -w /tmp/foo.img
debugfs: set_super_value inode_size 128
debugfs: set_super_value first_ino 11
debugfs: set_super_value rev_level 1
debugfs: quit

... although if you are typing it by hand, feel free to use "ssv" and
"q" instead of "set_super_value" and "quit", respectively.

Once you've coverted the file system to rev 1, you can then use
tune2fs -I 256 to rewrite the inode size to be 256 bytes.  Note that
this is a somewhat danderous operation, since if your system suffers a
power outage or crash while doing the conversion, the file system will
be left in a pretty terrible state.  So I strongly recommend that
people make a backup first before using tune2fs -I 256.



Also, FYI, if you want to add support for checking xfs file systems,
xfsprogs older than version 5.15 do not enable bigtime by default,
since xfs file sysems with bigtime=1 can't be mounted by kernes older
than 5.10.

So for example:

root@kvm-xfstests:~# mkfs.xfs -f -m bigtime=0 /dev/vdc
meta-data=/dev/vdc               isize=512    agcount=4, agsize=327680 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=1
         =                       reflink=1    bigtime=0 inobtcount=1 nrext64=1
         =                       exchange=0  
data     =                       bsize=4096   blocks=1310720, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1, parent=0
log      =internal log           bsize=4096   blocks=16384, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
Discarding blocks...Done.
root@kvm-xfstests:~# mount /dev/vdc /vdc
[ 1347.319906] XFS (vdc): Mounting V5 Filesystem 
01036e81-df84-42d8-962e-3efc3ec3c823
[ 1347.324156] XFS (vdc): Ending clean mount
[ 1347.324883] xfs filesystem being mounted at /vdc supports timestamps until 
2038-01-19 (0x7fffffff)


And if you want to simulate what an older version of xfsprogs actually creates:

root@kvm-xfstests:~# mkfs.xfs -f -m crc=0 /dev/vdc
V4 filesystems are deprecated and will not be supported by future versions.
meta-data=/dev/vdc               isize=256    agcount=4, agsize=327680 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0, sparse=0, rmapbt=0
         =                       reflink=0    bigtime=0 inobtcount=0 nrext64=0
         =                       exchange=0  
data     =                       bsize=4096   blocks=1310720, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1, parent=0
log      =internal log           bsize=4096   blocks=16384, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
Discarding blocks...Done.
root@kvm-xfstests:~# mount /dev/vdc /vdc
[   18.545268] XFS (vdc): Deprecated V4 format (crc=0) will not be supported 
after September 2030.
[   18.545956] XFS (vdc): Mounting V4 Filesystem 
08927fb0-dd8e-4c3c-b7dc-e09595c4185e
[   18.550241] XFS (vdc): Ending clean mount
[   18.550468] xfs filesystem being mounted at /vdc supports timestamps until 
2038-01-19 (0x7fffffff)

Unfortunately, there is no way to upgrade a v4 xfs file system to v5
without doing a backup, reformat, and restore operation.

Cheers,

                                                - Ted

Reply via email to