Quoting Adam Borowski (kilob...@angband.pl):

[enabling metadata checksums on relatively old ext4 filesystems:]

> Thus, if you created your filesystem with mkfs.ext4 older than
> stretch/ascii, it's vital that you do the following, on an unmounted
> filesystem (ie, need to boot from alternate media if it's /):
> 
> resize2fs -b $DEV
> tune2fs -O metadata_csum $DEV
> fsck.ext4 -D $DEV

First, thank you.  We're all richer for this sharing of knowledge.

https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout clarifies what
this specific command sequence is about: the '64bit' feature and its
connection to block size and to the metadata checksum option:

  By default a filesystem can contain 2^32 blocks; if the '64bit'
  feature is enabled, then a filesystem can have 2^64 blocks.
  [...]

  Some [hisorical ext4] data structures did not have space to fit a full
  32-bit checksum, so only the lower 16 bits are stored. Enabling the
  64bit feature increases the data structure size so that full 32-bit
  checksums can be stored for many data structures. However, existing
  32-bit filesystems cannot be extended to enable 64bit mode, at least not
  without the experimental resize2fs patches to do so.

One gathers that the 'experimental resize2fs patches' have been merged
since the above was written.

  Existing filesystems can have checksumming added by running tune2fs -O
  metadata_csum against the underlying device.
  [...]

So, 'resize2fs -b [devicename]' turns on the filesystem's 64bit feature,
rewriting ext4 metadata in a way that makes adequate room for storing
full 32-bit checksums on all file metadata structures instead of just
the lower 16 bits -- with the minor drawback of making the ext4
filsystem unmountable by systems with pre-3.6 kernels.  Having done this
house-cleaning, now you can do the second command that toggles on the
metadata checksum option.  Last, 'fsck.ext4 -D [devicename' 'optimises'
(reindexes, or sorts and compresses) all directories.

-- 
Cheers,              "Like running into a burning building and trying to put the
Rick Moen             fire out by means of interpretive dance." -- Iain M. Banks
r...@linuxmafia.com   on alternative cancer treatments, after his own diagnosis
McQ! (4x80) www.theguardian.com/books/2013/jun/15/iain-banks-the-final-interview
_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to