Set some disk params to be safe

2013-09-05 469 words 3 mins read

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

author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it