Advertisement
xe1phix

Xe1phix-[XFS]-Cheatsheet-[v4.7.5].sh

Nov 10th, 2022
1,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.89 KB | None | 0 0
  1. #!/bin/sh
  2. ##-==================================-##
  3. ##   [+] Xe1phix-XFS-Cheatsheet.sh
  4. ##-==================================-##
  5.  
  6.  
  7.  
  8. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  9.     mkfs.xfs -l logdev=/dev/sdb1,size=10m /dev/sda1
  10.     mkfs.xfs -l internal,size=10m
  11. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  12.     xfs_info /dev/sda1
  13. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  14.     xfsdump -f /mnt/bkup /mnt/xfsdata                   ## Creates a file-based backup of the /mnt/xfsdata directory
  15.     xfsdump -v debug -p 15 -f /mnt/bkup /mnt/xfsdata    ## Verbose (debug), 15 sec intervals,
  16. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  17.     xfs_metadump -g $Source $Target                     ## Shows dump progress.
  18.     xfs_metadump -g /dev/$Disk ~/xfs-metadata
  19. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  20.     xfs_metadump /dev/sdd ~/xfs-metadata
  21. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  22.     xfs_metadump -g -l $dst /dev/sdd ~/xfs-metadata     ## external log
  23.     xfs_metadump -a -g /dev/sdd ~/xfs-metadata          ## Copies entire metadata blocks
  24. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  25.     xfs_mdrestore -g -i $Source $Target
  26.     xfs_mdrestore -g -i ~/xfs-metadata /dev/$Disk
  27. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  28.     xfs_check /dev/$Disk
  29. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  30.     xfs_repair -v -t 17 /dev/$Disk
  31. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  32.     xfsrestore -f ~/xfsdump-data -L $session_label /dev/$Disk
  33.     xfsrestore -f ./xfsdump-data -L 'session1' /dev/$Disk
  34. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  35.  
  36. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  37.     xfs_repair -n -x        ## Read all file data extents to look for disk errors.
  38. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  39.     xfs_repair -n           ## no modify mode
  40. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  41.  
  42.  
  43. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  44.     xfs_info /dev/sdb1                  ## Query the filesystem for information:
  45. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  46.     xfs_admin -u /dev/vda1              ## UUID associated with the noted LV:
  47. ##~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~##
  48.  
  49.  
  50. ##-=========================================================================================================-##
  51.     xfs_admin -j /dev/sda       ## Enables version 2 log format (journal which supports larger log buffers)
  52. ##-=========================================================================================================-##
  53.     xfs_admin -u /dev/sda1      ## Display filesystems UUID
  54. ##-=========================================================================================================-##
  55.     xfs_admin -l /dev/sda       ## Display filesystems label
  56. ##-=========================================================================================================-##
  57.  
  58.  
  59. ##-=========================================================================================================-##
  60.     xfs_quota -x -c 'report -h' /home       ## display a sample quota report for /home
  61. ##-=========================================================================================================-##
  62.  
  63.  
  64. ##-===========================================================================-##
  65. ##   [+] Set a soft and hard inode count limit of 500 and 700 for user john
  66. ##-===========================================================================-##
  67. xfs_quota -x -c 'limit isoft=500 ihard=700 john' /home/
  68.  
  69.  
  70. ##-=============================================================-##
  71. ##   [+] Set a soft and hard block limit of 1000m and 1200m
  72. ##       [-] Apply to the $Group group
  73. ##       [-] Use the $Path File system
  74. ##-=============================================================-##
  75. xfs_quota -x -c 'limit -g bsoft=1000m bhard=1200m $Group' $Path
  76.  
  77.  
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement