4

I bought a new 2.5-inch external hard drive of 5TB in size from Seagate.

On my Linux Mint 21.1 now, I need to format the newly created partition with gdisk:

Model: Expansion HDD Sector size (logical/physical): 512/4096 bytes Disk identifier (GUID): 52CB8F84-EFAF-4EC9-B65D-6F8541A65F53 Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 9767541133 Partitions will be aligned on 2048-sector boundaries Total free space is 2014 sectors (1007.0 KiB) Number Start (sector) End (sector) Size Code Name 1 2048 9767541133 4.5 TiB 8300 Seagate_5TB_Ext4 

visible now with fdisk as:

Disk /dev/sdb: 4.55 TiB, 5000981077504 bytes, 9767541167 sectors Disk model: Expansion HDD Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: gpt Disk identifier: 52CB8F84-EFAF-4EC9-B65D-6F8541A65F53 Device Start End Sectors Size Type /dev/sdb1 2048 9767541133 9767539086 4.5T Linux filesystem 

and I want to use Ext4 as a file system.

The question is, is there some data checksumming in place by default, or do I need to use some option like explicitly:

mkfs.ext4 -O metadata_csum,64bit /dev/path/to/disk 

as is stated on Ext4 Metadata Checksums Linux Kernel page?

Thank you.

Note that I, thus far, used these command-line options for Ext4:

mkfs.ext4 -L Seagate_5TB_Ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0 /dev/sdX 
3
  • Regarding ext4 in particular && no RAID : What would you expect (in terms of added value) from crc-32 checksumming whatever (data, metadata) ? Commented Feb 19, 2023 at 12:27
  • @MC68020 I'd expect slightly better error detection I assume. Commented Feb 19, 2023 at 12:41
  • Note that metadata checksumming only covers (some?) filesystem structures, not file contents. Commented Feb 19, 2023 at 22:13

1 Answer 1

4

Defaults change over time, and might also depend on your distro.

You can check it yourself with tune2fs -l. Format in different ways and compare tune2fs output.

For testing only, you can also create sparse files of identical size. This avoids having to format your existing filesystems for testing.

The size should be similar (or identical) to your intended target device size, as some flags might also depend on size.

truncate -s 1T a.img b.img 

Format them with different flags.

mkfs.ext4 a.img mkfs.ext4 -O metadata_csum,64bit b.img 

Compare tune2fs -l output with diff -u:

tune2fs -l a.img > a.img.tune2fs tune2fs -l b.img > b.img.tune2fs diff -u a.img.tune2fs b.img.tune2fs 

Result:

# diff -U 0 a.img.tune2fs b.img.tune2fs --- a.img.tune2fs 2023-02-19 14:08:59.338434366 +0100 +++ b.img.tune2fs 2023-02-19 14:09:03.321859687 +0100 @@ -4 +4 @@ -Filesystem UUID: 88952b27-467d-4232-a310-030eaf463d7c +Filesystem UUID: b6720761-1fd9-45e6-afd4-2ec7fe63cafb @@ -29 +29 @@ -Filesystem created: Sun Feb 19 14:08:35 2023 +Filesystem created: Sun Feb 19 14:08:39 2023 @@ -31 +31 @@ -Last write time: Sun Feb 19 14:08:35 2023 +Last write time: Sun Feb 19 14:08:39 2023 @@ -34 +34 @@ -Last checked: Sun Feb 19 14:08:35 2023 +Last checked: Sun Feb 19 14:08:39 2023 @@ -45 +45 @@ -Directory Hash Seed: efda347d-032b-4d84-81f0-8e86591be3c4 +Directory Hash Seed: 30a3a1b1-682f-4bcc-87f1-909fd577e2fa @@ -48,2 +48,2 @@ -Checksum: 0x2fbbf9c2 -Checksum seed: 0x683d2fee +Checksum: 0x40316d8f +Checksum seed: 0x58dc22cf 

In this case, there was no difference other than UUID, Timestamp, Hash/Checksums. Those are always different, so that's expected. So in my case on my system, specifying -O metadata_csum,64bit seems unnecessary.

Adding -m 0 -E lazy_itable_init=0,lazy_journal_init=0 results in:

@@ -15 +15 @@ -Reserved block count: 13421772 +Reserved block count: 0 

Using mkfs.ext2 instead of mkfs.ext4 (just to illustrate that it does show when there are different flags active):

@@ -7 +7 @@ -Filesystem features: has_journal ext_attr resize_inode dir_index orphan_file filetype extent 64bit flex_bg metadata_csum_seed sparse_super large_file huge_file dir_nlink extra_isize metadata_csum +Filesystem features: ext_attr resize_inode dir_index filetype sparse_super large_file (and many other changes) 

So this is an example how to use tune2fs to check what kind of filesystem mke2fs actually made for you.

For final confirmation, you'll also have to check on the actual device, rather than test files as shown above (mkfs might pick some settings depending on device type).

If it turns out that you picked the wrong flags at mkfs time, some of them can also be changed on the fly (using either tune2fs or resize2fs) without needing to re-format.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.