Advertisement
xe1phix

Xe1phix-[Ext4]-Cheatsheet-[v4.2.54].sh

Jun 28th, 2023
861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.35 KB | Cybersecurity | 0 0
  1. #!/bin/sh
  2.  
  3.  
  4. ##-========================================================================-##
  5. ##   [+] Create A Ext4 Filesystem, specifying a block size of 4096-byte blocks:
  6. ##-========================================================================-##
  7. mkfs.ext4 -b 4096 -O metadata_csum /dev/sde1
  8.  
  9.  
  10.  
  11.  
  12. ##-========================================================================-##
  13. ##   [+] Create a journal of size 512MB:
  14. ##-========================================================================-##
  15. tune2fs -j -J size=512 /dev/sda1
  16.  
  17.  
  18. ##-========================================================================-##
  19. ##   [+] Create a journal file on a different device
  20. ##       (here, /dev/hdb2) with this:
  21. ##-========================================================================-##
  22. mke2fs -O journal_dev /dev/sdb2
  23.  
  24.  
  25. ##-========================================================================-##
  26. ##   [+]
  27. ##-========================================================================-##
  28. tune2fs -O ^has_journal /dev/sde1
  29.  
  30.  
  31. ##-========================================================================-##
  32. ##   [+] Create a journal for an ext2 filesystem is as follows:
  33. ##-========================================================================-##
  34. tune2fs -j /dev/sda1
  35.  
  36.  
  37. tune2fs -c 0 /dev/sda1
  38. ##-========================================================================-##
  39. ##   [+] et the number of mounts between checks to 0
  40. ##-========================================================================-##
  41.  
  42.  
  43.  
  44. ##-========================================================================-##
  45. ##   [+] Create a journal of size 512MB:
  46. ##-========================================================================-##
  47. tune2fs -j -J size=512 /dev/sda1
  48.  
  49.  
  50. ##-========================================================================-##
  51. ##   [+] Create a journal file on a different device
  52. ##       (here, /dev/hdb2) with this:
  53. ##-========================================================================-##
  54. mke2fs -O journal_dev /dev/sdb2
  55.  
  56.  
  57. ##-========================================================================-##
  58. ##   [+] Ise this external journal file:
  59. ##-========================================================================-##
  60. tune2fs -j -J device=/dev/sdb2 /dev/sda1
  61.  
  62.  
  63.  
  64.  
  65. ##-========================================================================-##
  66. ##   [+] Mount a partition read-only
  67. ##-========================================================================-##
  68. mount -t ext3 -o ro /dev/sdb1 /mnt/tmp
  69.  
  70.  
  71. ##-========================================================================-##
  72. ##   [+] Remount /dev/sdb1 as read/write,
  73. ##-========================================================================-##
  74. mount -t ext3 -o remount,rw /dev/sdb1
  75.  
  76.  
  77.  
  78.  
  79. ##-====================================================================-##
  80. ##   [+] Clone a partition from physical disk /dev/sda, partition 1,  
  81. ##       to physical disk /dev/sdb, partition 1 with e2image, run
  82. ##-========================================================================-##
  83. e2image -ra -p /dev/sda1 /dev/sdb1
  84.  
  85.  
  86.  
  87.  
  88. ##-========================================================================-##
  89. ##   [+] Count ext4 events for the entire system, for 10 seconds:
  90. ##-========================================================================-##
  91. perf stat -e 'ext4:*' -a sleep 10
  92.  
  93.  
  94.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement