admin:linux:fs

File Systems

If you ask this question, probably the one which is default for your distribution or ext4.

Some good file systems and their usage:

ext4 root, data
btrfs redundant data, file servers
zfs redundant data, file servers
xfs root, data
f2fs flash storage
glusterfs computer clusters
ntfs shared storage with windows (slow, because fuse)

Could be that you ran out of inodes. Check with df -i.

change label xfs_admin -L NEWLABEL /dev/mapper/NAME

init ext4 inodes on mkfs

lazy inode init makes the drive behave slowly on first mount

mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/sdXY

directory index for a huge amount of files

Huge amount = >300k

mount with dir_index

if the error EXT4-fs warning (device /dev/sdx): ext4_dx_add_entry: Directory index full! occurs, you probably have more than 2 million files in one directory, check with

$ cd /var/
$ debugfs
debugfs> open /dev/sdd1
debugfs> cd log/
debugfs> htree .
[...]
Number of Entries (count): 508
Number of Entries (limit): 508
[...]

and remedy with fsck.ext4 -yfD /dev/sdx1

(source)

RAID-1

mkfs.btrfs -L LABEL -d raid1 -m raid1  /dev/sdd1 /dev/sde1

RAID-0 mit existierender Festplatte

  1. ! MAKE BACKUPS !!!
  2. gdisk /dev/sdx: one GPT partition over the whole disk
  3. mkfs.btrfs /dev/sdx1
  4. mount /dev/sdx1 /mnt/data
  5. rsync -a –info=progress2 /mnt/olddata /mnt/data
  6. gdisk /dev/sdx: one GPT partition spanning the whole disk
  7. btrfs device add /dev/sdx1 /mnt/data
  8. btrfs balance start -dconvert=raid0 -mconvert=raid1 /mnt/data
  9. done.
  1. ! MAKE BACKUPS !!! gdisk /dev/sdx: b → sdx-backup
  2. note output from blkid /dev/sdx1
  3. btrfs fi res
  4. note devid 1 size from btrfs fi sh –raw /mnt/point output
  5. note the Partition unique GUID and Logical sector size from gdisk -l /dev/sdx1 output
  6. gdisk /dev/sdx: d → n → 1 → 2048 → 2048+size/Logical sector size → 8300 → x → c → PARTUUID → w
  7. btrfs check /dev/sdx1
  8. mount, btrfs scrub start /mnt/point (check with btrfs scrub status /mnt/point

For interoperability with Windows; is mounted with FUSE and therefore pretty slow.

Use mount options fmask=117,dmask=007 so the executable bit isn't set on everything.

  • Last modified: 2020-02-02 11:53