Tag: FileSystem

force recheck on reboot – fsck

If you want to force a fsck re-check on reboot, then just

touch /forcefsck

 

Enhanced by Zemanta

find more information on ext2/3/4 filesystem

English: Ext3 & Ext4 file systems: fsck time v...
English: Ext3 & Ext4 file systems: fsck time vs Inode Count (Photo credit: Wikipedia)

In my previous post on check filesystem regurlarly, I mentioned tune2fs. That tool give quite a lot of information. But just in case, you did not find what you are looking for in the output, then you can get much more information on these partitions with the dumpe2fs command.

dumpe2fs

You do really get a lot of information, and here are some of them:

Filesystem volume name
Last mounted on
Filesystem UUID
Filesystem magic number
Filesystem revision #
Filesystem features
Filesystem flags
Default mount options
Filesystem state
Errors behavior
Filesystem OS type
Inode count
Block count
Reserved block count
Free blocks
Free inodes
First block
Block size
Fragment size
Reserved GDT blocks
Blocks per group
Fragments per group
Inodes per group
Inode blocks per group
Flex block group size
Filesystem created
Last mount time
Last write time
Mount count
Maximum mount count
Last checked
Check interval
Next check after
Lifetime writes
Reserved blocks uid
Reserved blocks gid
First inode
Inode size
Required extra isize
Desired extra isize
Journal inode
Default directory hash
Directory Hash Seed
Journal backup
Journal features
Journal size
Journal length
Journal sequence
Journal start

and much more……

 

Enhanced by Zemanta

Set some disk params to be safe

It is always “Better safe than sorry” so, here are some things you
should do..

First check fstab, if you have partitions other than root then use UUID instead of device:

 UUID=a8f13a0d-3f1f-42e4-b076-f44b4163306c /mnt/Backup     ext4 defaults,relatime 1 2

Then entries for all your mounts should be like above.
Points to note here :

Disk is mounted using the UUID and not with /dev/sdXX. This ensures
that even if your disk ids change, you will be able to mount them. To
get the partition UUID, you can execute :

lsblk -f
#OR
blkid /dev/sdXX

disk mouting params include relatime ( this is really optional and
depends on your personal preference.) When this option is set, basically
the acess time for the file and directories are update only on writes.
There is also a noatime option, but that has its own demerits. By
default the option is “atime” which means for each acess (even reads)
there will be a write ( to update the atime). So, setting this should
improve performance.
Make sure that last param is 2 and not zero. This would mean that
fsck checks are done and they are done after “/” checks

Now, we do little more to make sure that we are not delayed with fsck
every time the system boots. So, lets check some params for the
patitions, using tune2fs:

tune2fs -l /dev/sdXX |egrep -i '(Check|mount count)'

You should see output like below :

Mount count:              0
Maximum mount count:      40     
Last checked:             Wed Sep  4 08:37:24 2013     
Check interval:           2592000 (1 month)     
Next check after:         Fri Oct  4 08:37:24 2013

Here, points to note::

  • maximum mount count is set. This means that after every 40 mounts, the disk will be checked.
  • Check interval is set, so it means that after 1 month disk will be checked even if it was not mounted for 40 times in this period.

Now, if you dont have those, then you can execute:

 tune2fs -c 40 /dev/sdXX             # to set maximum mount count
tune2fs -i 1m /dev/sdXX             # to set the check interval
tune2fs -c 40 -i 1m /dev/sdXX       # to set both of above.

Now, one thing to keep in mind is to make sure that if you have multiple
partitions, which will be the case, then sparse the interval durations
and do not plan on using the same duration. This will ensure that your
fsck checks at boot time do not “ALL” happen on the same day, same time.

Was a bit tad longer than usual but thats all for today.
(In case you are still worried then you can always check for bad blocks with command “badblocks” and if you too worried then you should google
for “Why Linux does not need defragmentation”)

 

 

Enhanced by Zemanta