Linux: Working with XFS - Paiet/Tech-Journal-for-Everything GitHub Wiki

EXT to XFS Command Mapping

| EXT | XFS | Description | |-----------|------------|------------------------------| | mkfs.ext4 | mkfs.xfs | Creates a file system | | e2fsck | xfs_repair | Corrects file system errors | | resize2fs | xfs_growfs | Add storage to a file system | | tune2fs | xfs_admin | Adjust file system options | | dump | xfsdump | Backup a file system | | restore | xfsrestore | Restore a file system |

Format a volume with XFS mkfs.xfs /dev/sdb1

Clear dirty writes from the journal mount /dev/sdb1 umount /dev/sdb1

Repair a damaged file system umount /dev/sdb1 xfs_repair /dev/sdb1

Grow a file system yum install -y system-storage-manager ssm create -s 100G -n website --fstype xfs -p vg1 /dev/sdc1 /dev/sdd1 /website ssm resize -s +100G /dev/vg1/website or xfs_growfs /dev/sdb1 or xfs_growfs /dev/sdb1 -D <size>

Changing file system options View the drive label xfs_admin -l /dev/sdb1 Change the drive label xfs_admin -L <label> /dev/sdb1 View the drive UUID xfs_admin -u /dev/sdb1 Change the drive UUID xfs_admin -U <uuid> /dev/sdb1

Backup an XFS volume

  • xfsdump syntax
    • xfsdump -l <#> -f <destination> <source>
    • -l is the backup level
      • 0 is a full backup
      • 1 through 9 are incremental dumps to be used in order
    • -f is the destination
      • /dev/st0 or /dev/tape for tape
      • File name for standard file
  • Full backup to file
    • xfsdump -f /mnt/backup/website.bak -l 0 -M website -L full_backup /mnt/website
  • Backup rotation to tape
    • xfsdump -f /dev/tape -l 0 -M website -L M-Full /mnt/website
    • xfsdump -f /dev/tape -l 1 -M website -L T-Inc /mnt/website
    • xfsdump -f /dev/tape -l 2 -M website -L W-Inc /mnt/website
  • View backup information
    • xfsdump -I *Restore an XFS volume
    • xfsrestore syntax
      • xfsrestore -f <source> <destination>
    • Simple non-cumulative restore
      • xfsrestore -f /mnt/backup/server1.bak /mnt/website
    • Perform a cumulative restore
      • xfsrestore -r -f /dev/tape /mnt/website
    • Restore a single file
      • xfsrestore -f /mnt/backup/server1.bak -L M-Full -s images/logo.png ~/
⚠️ **GitHub.com Fallback** ⚠️