ext4: Может ли чистая файловая система нуждаться в восстановлении журнала?

Причиной, почему VDI быстрее, является кэш ОС файл изображения. И операции ввода-вывода буферизуются в памяти.

Было бы более справедливо, если можно закрыть функцию кэша в virtualbox для этого сравнительного теста.

3
02.06.2015, 01:34
1 ответ

.

«Чистая» в конце выхода «FSCK -N» вводит в заблуждение. Это не означает, что восстановление не нужно. Это просто означает, что если бы вы достигли этого момента, без -на, файловая система была бы чистой.

Как воспроизвести:

sh-4.3# dd if=/dev/zero of=/tmp/test.fs bs=1M count=5
5+0 records in
5+0 records out
5242880 bytes (5.2 MB) copied, 0.00333063 s, 1.6 GB/s
sh-4.3# mkfs.ext4 /tmp/test.fs
mke2fs 1.42.12 (29-Aug-2014)
Discarding device blocks: done                            
Creating filesystem with 5120 1k blocks and 1280 inodes

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done
sh-4.3# mkdir /tmp/t
sh-4.3# mount -o loop /tmp/test.fs /tmp/t
sh-4.3# ls / > /tmp/t/file
sh-4.3# umount /tmp/test.fs 
sh-4.3# fsck -n /tmp/test.fs
fsck from util-linux 2.25.2
e2fsck 1.42.12 (29-Aug-2014)
/tmp/test.fs: clean, 12/1280 files, 1224/5120 blocks
sh-4.3# mount -o loop /tmp/test.fs /tmp/t
sh-4.3# ls / > /tmp/file2
sh-4.3# cp /tmp/test.fs /tmp/test-unclean.fs
sh-4.3# fsck.ext4 -n /tmp/test-unclean.fs 
e2fsck 1.42.12 (29-Aug-2014)
Warning: skipping journal recovery because doing a read-only filesystem check.
/tmp/test-unclean.fs: clean, 12/1280 files, 1224/5120 blocks
sh-4.3# mkdir /tmp/t2
sh-4.3# mount -o loop /tmp/test-unclean.fs /tmp/t2
sh-4.3# dmesg | tail
...
[66569.074538] EXT4-fs (loop1): recovery complete
[66569.074554] EXT4-fs (loop1): mounted filesystem with ordered data mode. Opts: (null)
sh-4.3# umount /tmp/test-unclean.fs 
sh-4.3# fsck -n /tmp/test-unclean.fs 
fsck from util-linux 2.25.2
e2fsck 1.42.12 (29-Aug-2014)
/tmp/test-unclean.fs: clean, 12/1280 files, 1224/5120 blocks
2
27.01.2020, 21:27

Теги

Похожие вопросы