Filesystem

Infos and notes regarding the filesystem in general.

Useful links:

Filetime

  • mtime – the file modification time
  • atime – the file access time
  • ctime – the inode change time

The mtime is the file modification time for a for a file or directory and records the time that the file was last modified. It is updated by the filesystem each time the file is modified. To display a file's mtime run: ls -l <filename>

The atime is the file access time for a file or directory and records the time the file was last accessed. It is updated by the filesystem each time the file is accessed for a read or write operation. To display a file's atime run: ls -lu <filename>

The ctime is the file change time for a file or directory and records the time file's inode was last changed. It is updated by the filesystem each time the file's permissions, ownership, link-counts, etc. are changed. To display a file's ctime run: ls -lc <filename>

disable atime

Disabling atime for a partition may improve performance.

Edit fstab:

[...]
/dev/vg0/srv            /srv                    ext3    defaults,noatime        1 2
[...]

Remount filesytem or reboot. :!: If in doubt reboot, as a remount could result in data loss!

mount -o remount /srv

ext3

filesystem check

Doing a filesystem check with e2fsck:

e2fsck /dev/hda1
e2fsck 1.27 (8-Mar-2002)
/dev/hda1: recovering journal
/dev/hda1 has gone 413 days without being checked, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

Usage:

Usage: e2fsck [-panyrcdfvstDFSV] [-b superblock] [-B blocksize]
                [-I inode_buffer_blocks] [-P process_inode_size]
                [-l|-L bad_blocks_file] [-C fd] [-j ext-journal]
                [-E extended-options] device

Emergency help:
 -p                   Automatic repair (no questions)
 -n                   Make no changes to the filesystem
 -y                   Assume "yes" to all questions
 -c                   Check for bad blocks and add them to the badblock list
 -f                   Force checking even if filesystem is marked clean
 -v                   Be verbose
 -b superblock        Use alternative superblock
 -B blocksize         Force blocksize when looking for superblock
 -j external-journal  Set location of the external journal
 -l bad_blocks_file   Add to badblocks list
 -L bad_blocks_file   Set badblocks list

tune2fs

Show what's currently configured:

tune2fs -l /dev/sda2

output:

tune2fs 1.39 (29-May-2006)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          6fa0902f-5f88-443e-b56e-5f76619b111e
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              38404096
Block count:              38395904
Reserved block count:     1919795
Free blocks:              37145246
Free inodes:              38404083
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1014
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         32768
Inode blocks per group:   1024
Filesystem created:       Tue Jan  6 15:25:48 2009
Last mount time:          Wed Jan  7 07:56:24 2009
Last write time:          Wed Jan  7 07:56:24 2009
Mount count:              5
Maximum mount count:      -1
Last checked:             Tue Jan  6 15:25:48 2009
Check interval:           0 (<none>)
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      ee47bb02-4b7d-4033-9581-1d63cc826045
Journal backup:           inode blocks

Reduce the amount of reserved blocks for the superuser (can be handy on big partitions where root doesn't need too much space)

tune2fs -m 2 /dev/sda2

This will reduce the amount of reserved blocks to 2 % (default is 5%)

xfs

Howto use labels:

xfs_admin

# show labels:
xfs_admin -l /dev/sda7

# rename a label:
xfs_admin -L yourlabel /dev/sda7
linux/filesystem.txt · Last modified: 2009/01/07 10:11 by tb
CC Attribution-Noncommercial-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0