Filesystem

Infos and notes regarding the filesystem in general.

Useful links:

How to determine the filesystem type of a partition which is NOT mounted:

parted -l

Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg00-var: 3221MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0,00B  3221MB  3221MB  ext3

UUID

Ever wondered how you can find out the UUID of a specific partition?

Here we go:

blkid 
/dev/sda1: UUID="d345c1ea-dd86-4aff-a934-d01524891aa4" TYPE="ext2"
/dev/sda2: UUID="ae9ed360-3085-4fa9-a2a8-e29240e41d8d" TYPE="swap"
/dev/sda3: UUID="2900b27e-290b-4a6d-93f2-b280eb741406" TYPE="ext3"
 
ls -Al /dev/disk/by-uuid 
lrwxrwxrwx 1 root root 10 Nov  7 14:24 2900b27e-290b-4a6d-93f2-b280eb741406 -> ../../sda3
lrwxrwxrwx 1 root root 10 Nov  7 14:24 ae9ed360-3085-4fa9-a2a8-e29240e41d8d -> ../../sda2
lrwxrwxrwx 1 root root 10 Nov  7 14:24 d345c1ea-dd86-4aff-a934-d01524891aa4 -> ../../sda1
 
tune2fs -l /dev/sda1
tune2fs 1.42.5 (29-Jul-2012)
Filesystem volume name:   <none>
Last mounted on:          /media/rotten/boot
Filesystem UUID:          d345c1ea-dd86-4aff-a934-d01524891aa4
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      ext_attr resize_inode dir_index filetype sparse_super
Filesystem flags:         signed_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         not clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              24096
Block count:              96256
Reserved block count:     4812
Free blocks:              59057
Free inodes:              23845
First block:              1
Block size:               1024
Fragment size:            1024
Reserved GDT blocks:      256
Blocks per group:         8192
Fragments per group:      8192
Inodes per group:         2008
Inode blocks per group:   251
Filesystem created:       Thu Nov  7 13:10:41 2013
Last mount time:          Thu Nov  7 13:38:22 2013
Last write time:          Thu Nov  7 14:28:25 2013
Mount count:              2
Maximum mount count:      -1
Last checked:             Thu Nov  7 14:20:11 2013
Check interval:           0 (<none>)
Lifetime writes:          32 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Default directory hash:   half_md4
Directory Hash Seed:      b9ff6477-9799-4d1f-ba1c-de0cba549058

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

Show infos

xfs_info /dev/mapper/vg02-dta0
Metadaten =/dev/mapper/vg02-dta0  isize=256    agcount=55, agsize=25165792 blks
          =                       sectsz=512   attr=2
Daten     =                       bsize=4096   Blöcke=1377828864, imaxpct=5
          =                       sunit=32     swidth=96 blks
Benennung =Version 2              bsize=4096   ascii-ci=0
Protokoll =Intern                 bsize=4096   Blöcke=393216, Version=2
          =                       sectsz=512   sunit=32 blks, lazy-count=1
Echtzeit  =keine                  extsz=4096   Blöcke=0, rtextents=0
linux/filesystem.txt · Last modified: 2013-11 by tb
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready