Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ##-==================================-##
- ## [+] Xe1phix-XFS-Cheatsheet.sh
- ##-==================================-##
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- mkfs.xfs -l logdev=/dev/sdb1,size=10m /dev/sda1
- mkfs.xfs -l internal,size=10m
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- xfs_info /dev/sda1
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- xfsdump -f /mnt/bkup /mnt/xfsdata ## Creates a file-based backup of the /mnt/xfsdata directory
- xfsdump -v debug -p 15 -f /mnt/bkup /mnt/xfsdata ## Verbose (debug), 15 sec intervals,
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- xfs_metadump -g $Source $Target ## Shows dump progress.
- xfs_metadump -g /dev/$Disk ~/xfs-metadata
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- xfs_metadump /dev/sdd ~/xfs-metadata
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- xfs_metadump -g -l $dst /dev/sdd ~/xfs-metadata ## external log
- xfs_metadump -a -g /dev/sdd ~/xfs-metadata ## Copies entire metadata blocks
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- xfs_mdrestore -g -i $Source $Target
- xfs_mdrestore -g -i ~/xfs-metadata /dev/$Disk
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- xfs_check /dev/$Disk
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- xfs_repair -v -t 17 /dev/$Disk
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- xfsrestore -f ~/xfsdump-data -L $session_label /dev/$Disk
- xfsrestore -f ./xfsdump-data -L 'session1' /dev/$Disk
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- xfs_repair -n -x ## Read all file data extents to look for disk errors.
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- xfs_repair -n ## no modify mode
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- xfs_info /dev/sdb1 ## Query the filesystem for information:
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- xfs_admin -u /dev/vda1 ## UUID associated with the noted LV:
- ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
- ##-=========================================================================================================-##
- xfs_admin -j /dev/sda ## Enables version 2 log format (journal which supports larger log buffers)
- ##-=========================================================================================================-##
- xfs_admin -u /dev/sda1 ## Display filesystems UUID
- ##-=========================================================================================================-##
- xfs_admin -l /dev/sda ## Display filesystems label
- ##-=========================================================================================================-##
- ##-=========================================================================================================-##
- xfs_quota -x -c 'report -h' /home ## display a sample quota report for /home
- ##-=========================================================================================================-##
- ##-===========================================================================-##
- ## [+] Set a soft and hard inode count limit of 500 and 700 for user john
- ##-===========================================================================-##
- xfs_quota -x -c 'limit isoft=500 ihard=700 john' /home/
- ##-=============================================================-##
- ## [+] Set a soft and hard block limit of 1000m and 1200m
- ## [-] Apply to the $Group group
- ## [-] Use the $Path File system
- ##-=============================================================-##
- xfs_quota -x -c 'limit -g bsoft=1000m bhard=1200m $Group' $Path
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement