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
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

Disk identification by UUID in Fedora.

Yesterday I managed to delete my complete /usr directory and thus had to re-install my OS but I learned something new yesterday which I didn\’t know earlier or actually never bothered to find /br /All the partitions are mounted by udev using the UUID or label now. Finding the label of setting the label is easy but that was not the case with UUID (at least till you dont know how to do it). So finally I set my foot to search it. Heres some of the things that I found:br /br /bblkid/b – Gives you a list like below for all your partitions:br //dev/sda6: UUID=\”8D8A-6CF1\” TYPE=\”vfat\” LABEL=\”Backup\” br /So this is sufficient to modify your fstab to refer to the UUID or label instead of the drive. So whats the change in fstab. If the earlier entry looks likebr //dev/sdb6nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; /media/Bkup3nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; vfatnbsp;nbsp;nbsp; uid=500,nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 0 0br /then you can change this to :br /UUID=\”8D8A-6CF1\”nbsp;nbsp; /media/Bkup3nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; vfatnbsp;nbsp;nbsp; uid=500,nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 0 0br /What is the benifit:br /———————br /When you re-format your Hard Disk there is a likely possibility that the dev name could well change and thus completely changing the mount points for all your fstab entries. This is really a pain if you have 10 or more partitions like the way I have. So if you use label or UUID then they never change and your mount points remain the /br /Effective use: Use autofs package to automatically mount all your partitions. Autofs mounts the package at /media/LABEL, so before you hit to start your autofs label all your /br /Other ways to find the disk labels and UUID\’s:br /ls /dev/disk/by-uuid –gt; simplest way. :)br /br /Will get back to this later with more /br /