Weniger Speicherplatz: 2TB EXT4 vs 2TB NTFS?

1126 Wörter 6 Minuten Lesezeit

Eine gut gefüllte 2TB große externe Festplatte mit NTFS Dateisystem soll auf ein EXT4 Dateisystem überführt werden. Die neue 2TB Harddisk wurde mittels eines simplen mke2fs -L NEWHDD /dev/sdX1 formatiert. Beim Kopieren der Daten dann die große Überraschung - zuwenig Speicherplatz vorhanden. Sind 2TB auf EXT4 “kleiner” als zuvor 2TB auf NTFS?

Kopieren von NTFS auf EXT4

Nach Stunden des Kopierens ist das rsync -av /run/media/anyuser/2TBalt/ /run/media/anyuser/NEWHDD/ mit der Fehlermeldung abgebrochen es sei kein Platz mehr vorhanden - und das obwohl auf der alten Festplatte noch rund 40GB frei waren.

rsync: [receiver] write failed on "/run/media/anyuser/NEWHDD/anyfile.bin": No space left on device (28)
rsync error: error in file IO (code 11) at receiver.c(378) [receiver=v3.2.3]
rsync: [sender] write error: Broken pipe (32)

$ df | grep sdX
/dev/sdX1                   1921724692 1821673168    2359464 100% /run/media/anyuser/NEWHDD

mke2fs /dev/sdX1

$ df -h | grep sdX
/dev/sdX1                    1,8T  1,7T  2,3G 100% /run/media/anyuser/NEWHDD

$ df -i | grep sdX
/dev/sdX1                   122101760  1666 122100094    1% /run/media/anyuser/NEWHDD

$ sudo tune2fs -l /dev/sdX1 | sort
Block count:              488378389
Block size:               4096
Blocks per group:         32768
Check interval:           0 (<none>)
Checksum:                 0xd91ee4ac
Checksum type:            crc32c
Default directory hash:   half_md4
Default mount options:    user_xattr acl
Desired extra isize:      32
Directory Hash Seed:      a59d82f2-bafc-4cce-bbcb-fa01acd6188c
Errors behavior:          Continue
Filesystem created:       Tue Mar 23 17:17:33 2021
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash 
Filesystem magic number:  0xEF53
Filesystem OS type:       Linux
Filesystem revision #:    1 (dynamic)
Filesystem state:         clean
Filesystem UUID:          01e93197-df26-4b39-979a-668fe956889b
Filesystem volume name:   NEWHDD
First block:              0
First inode:              11
Flex block group size:    16
Fragment size:            4096
Fragments per group:      32768
Free blocks:              480431166
Free inodes:              122101749
Group descriptor size:    64
Inode blocks per group:   512
Inode count:              122101760
Inode size:	          256
Inodes per group:         8192
Journal backup:           inode blocks
Journal inode:            8
Last checked:             Tue Mar 23 17:17:33 2021
Last mounted on:          /run/media/anyuser/NEWHDD
Last mount time:          Tue Mar 23 17:18:06 2021
Last write time:          Tue Mar 23 17:18:06 2021
Lifetime writes:          7935 kB
Maximum mount count:      -1
Mount count:              1
Overhead clusters:        7947216
Required extra isize:     32
Reserved block count:     24418919
Reserved blocks gid:      0 (group root)
Reserved blocks uid:      0 (user root)
Reserved GDT blocks:      1024

ext4 Formatierung richtig gemacht

Beim Formatieren mit EXT4 sollten statt der Standardparameter die korrekten Optionen von mkfs.ext4 gesetzt: kein extra Speicherplatz für den root User, die Inodes begrenzen - das sollte massiv Speicherplatz bringen.

Option Wirkung
-m 0 Prozent der exklusiven Blocks für root
-n 2000000 Anzahl an Inodes
-E lazy_itable_init=0,lazy_journal_init=0 beim Erstellen initialisieren, kein lazy
-T largefile4 Large-File Optimierung
$ time sudo mke2fs -L NEWHDD -m 0 -N 2000000 -T largefile4 -t ext4 -b 4096 -E lazy_itable_init=0,lazy_journal_init=0 -O ^resize_inode /dev/sdX1
mke2fs 1.46.2 (28-Feb-2021)
/dev/sdX1 contains a ext4 file system labelled 'NEWHDD'
	last mounted on /run/media/anyuser/NEWHDD on Wed Mar 24 09:00:19 2021
Proceed anyway? (y,N) y
Creating filesystem with 488378389 4k blocks and 2146320 inodes
Filesystem UUID: e8e82b96-c4df-4b10-9a2d-fc0caf6c28c0
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000, 214990848

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done       

real	2m38,257s
user	0m0,137s
sys	0m0,548s
$ df | grep sdX
/dev/sdX1                   1951791376         24 1951774968   1% /run/media/anyuser/NEWHDD

$ df -h | grep sdX
/dev/sdX1                    1,9T   24K  1,9T   1% /run/media/anyuser/NEWHDD

$ df -i | grep sdX
/dev/sdX1                    2146320    11  2146309    1% /run/media/anyuser/NEWHDD

$ sudo tune2fs -l /dev/sdX1 | sort
Block count:              488378389
Block size:               4096
Blocks per group:         32768
Check interval:           0 (<none>)
Checksum:                 0xe087dbcf
Checksum type:            crc32c
Default directory hash:   half_md4
Default mount options:    user_xattr acl
Desired extra isize:      32
Directory Hash Seed:      558e4e59-3875-4329-a821-892da90cc4cc
Errors behavior:          Continue
Filesystem created:       Wed Mar 24 09:44:40 2021
Filesystem features:      has_journal ext_attr dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash 
Filesystem magic number:  0xEF53
Filesystem OS type:       Linux
Filesystem revision #:    1 (dynamic)
Filesystem state:         clean
Filesystem UUID:          e8e82b96-c4df-4b10-9a2d-fc0caf6c28c0
Filesystem volume name:   NEWHDD
First block:              0
First inode:              11
Flex block group size:    16
Fragment size:            4096
Fragments per group:      32768
Free blocks:              487947838
Free inodes:              2146309
Group descriptor size:    64
Inode blocks per group:   9
Inode count:              2146320
Inode size:	          256
Inodes per group:         144
Journal backup:           inode blocks
Journal inode:            8
Last checked:             Wed Mar 24 09:44:40 2021
Last mounted on:          <not available>
Last mount time:          Wed Mar 24 09:47:33 2021
Last write time:          Wed Mar 24 09:47:33 2021
Lifetime writes:          3831 kB
Maximum mount count:      -1
Mount count:              1
Overhead clusters:        430545
Required extra isize:     32
Reserved block count:     0
Reserved blocks gid:      0 (group root)
Reserved blocks uid:      0 (user root)
tune2fs 1.46.2 (28-Feb-2021)

Mehr Infos zu EXT4 gibt’s beim im Archlinux Wiki.

Nach dem neuerlichen Kopieren schaut’s dann so aus…

$ df | grep sdX
/dev/sdX1                   1951791376 1917343560   34431432  99% /run/media/anyuser/NEWHDD

$ df -h | grep sdX
/dev/sdX1                    1,9T  1,8T   33G  99% /run/media/anyuser/NEWHDD

$ df -i | grep sdX
/dev/sdX1                    2146320  1787  2144533    1% /run/media/anyuser/NEWHDD

$ df -ih | grep sdX

$ sudo tune2fs -l /dev/sdX1 | sort
[sudo] password for anyuser: 
Block count:              488378389
Block size:               4096
Blocks per group:         32768
Check interval:           0 (<none>)
Checksum:                 0x5737a6f2
Checksum type:            crc32c
Default directory hash:   half_md4
Default mount options:    user_xattr acl
Desired extra isize:      32
Directory Hash Seed:      558e4e59-3875-4329-a821-892da90cc4cc
Errors behavior:          Continue
Filesystem created:       Wed Mar 24 09:44:40 2021
Filesystem features:      has_journal ext_attr dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash 
Filesystem magic number:  0xEF53
Filesystem OS type:       Linux
Filesystem revision #:    1 (dynamic)
Filesystem state:         clean
Filesystem UUID:          e8e82b96-c4df-4b10-9a2d-fc0caf6c28c0
Filesystem volume name:   NEWHDD
First block:              0
First inode:              11
Flex block group size:    16
Fragment size:            4096
Fragments per group:      32768
Free blocks:              487947838
Free inodes:              2146309
Group descriptor size:    64
Inode blocks per group:   9
Inode count:              2146320
Inode size:	          256
Inodes per group:         144
Journal backup:           inode blocks
Journal inode:            8
Last checked:             Wed Mar 24 09:44:40 2021
Last mounted on:          /run/media/anyuser/NEWHDD
Last mount time:          Wed Mar 24 09:47:33 2021
Last write time:          Wed Mar 24 09:47:33 2021
Lifetime writes:          3831 kB
Maximum mount count:      -1
Mount count:              1
Overhead clusters:        430545
Required extra isize:     32
Reserved block count:     0
Reserved blocks gid:      0 (group root)
Reserved blocks uid:      0 (user root)
tune2fs 1.46.2 (28-Feb-2021)

Berechtigungen korrigieren

sudo tune2fs -o acl /dev/sdX1
setfacl -m d:u::rwx,d:g::rwx,d:o::rwx /run/media/anyuser/NEWHDD/
find /run/media/anyuser/NEWHDD/ -type f -print0 | xargs -0 -I {} chmod 666 {};

Siehe wiederum das Archlinux Wiki

rsync

Im Übrigen dauert das Kopieren der 2 Terabyte Daten von der NTFS auf die EXT4 Festplatte rund 9 Stunden…

time rsync -av /run/media/anyuser/2TBalt/Media/ /run/media/anyuser/NEWHDD/Media/

sent 1,963,830,623,776 bytes  received 30,143 bytes  60,174,676.47 bytes/sec
total size is 1,963,351,161,012  speedup is 1.00

real	543m54,724s
user	41m20,263s
sys	102m31,871s