cubieplayer / Cubian

Debian for Cubieboard
http://cubian.org
271 stars 49 forks source link

Ext2 partition marked dirty ("not clean") on mount and clean on umount. #445

Closed vovcacik closed 8 years ago

vovcacik commented 9 years ago

Hi, is it normal behaviour to mark ext2 partition dirty on mount and clean on umount? Online fsck recognize the partition as dirty but returns no errors. Offline fsck recognize it as clean and return same output as online fsck. I don't see same behaviour for ext4 partitions for example.

kdeenkhoorn commented 8 years ago

Yes this is normal behaviour. As soon as you mount an ext2 filesystem things get changed like access times of files and directories, so its getting marked as dirty. Most of the changes are placed in cache buffers in memory first before written to disk. On unmount of the filesystem all these buffers are synced to the disk and if this is done the filesystem is marked clean and closed.

And please never run fsck to fix errors on a mounted filesystem because of these memory buffers. Fsck is not aware of the contents of the buffercache. Unmount first before fixing.