Monday, September 8, 2008

Viewing and Changing File System Attributes

Using the tune2fs or dumpe2fs commands, you can view attributes of ext2 and ext3 file
systems. The tune2fs command can also be used to change file system attributes. Use the
swapfs command to create a swap partition. Here are examples (both commands produce the same output):

$ sudo tune2fs -l /dev/sda1 View tunable file system attributes
$ sudo dumpe2fs -h /dev/sda1 Same as tune2fs output

To change settings on an existing ext2 or ext3 file system, you can use the tune2fs command. The following command changes the number of mounts before a forced file system check:

$ sudo tune2fs -c 31 /dev/sda1 Sets # of mounts before check is forced

tune2fs 1.39 (29-May-2006)
Setting maximal mount count to 31


If you’d like to switch to forced file system checks based on time interval rather than number
of mounts, disable mount-count checking by setting it to negative 1 (-1):

$ sudo tune2fs -c -1 /dev/sda1

tune2fs 1.39 (29-May-2006)
Setting maximal mount count to -1


Use the -i option to enable time-dependent checking. Here are some examples:

$ sudo tune2fs -i 10 /dev/sda1 Check after 10 days

$sudo tune2fs -i 1d /dev/sda1 Check after 1 day

$sudo tune2fs -i 3w /dev/sda1 Check after 3 weeks

$sudo tune2fs -i 6m /dev/sda1 Check after 6 months

$sudo tune2fs -i 0 /dev/sda1 Disable time-dependent checking


Be sure you always have either mount-count or time-dependent checking turned on.
Use the -j option to turn an ext2 file system into ext3 (by adding a journal):

$ sudo tune2fs -j /dev/sda1 Add journaling to change ext2 to ext3

No comments:

Post a Comment