This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

File System Check

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

Linux command-line file system check programs are essential tools for verifying and repairing file systems. These programs scan the file system for errors and inconsistencies, ensuring data integrity and preventing data loss. They are crucial for maintaining a healthy and reliable storage environment, especially after unexpected shutdowns or hardware failures.

One of the primary functions of file system check programs is to detect and fix errors in the file system’s metadata, such as incorrect file pointers, orphaned files, and directory structure issues. By addressing these errors, the programs help maintain the file system’s overall stability and performance. Regular file system checks can prevent minor issues from escalating into major problems that could lead to data corruption or loss.

These programs also provide detailed reports on the file system’s health, including information about bad sectors, disk usage, and potential issues that may require further attention. Administrators can use this information to make informed decisions about system maintenance and upgrades. Additionally, file system check programs often include options for running checks in read-only mode, allowing administrators to assess the file system’s condition without making any changes.

Overall, Linux command-line file system check programs are indispensable for effective system administration. They ensure that file systems remain in good working order, safeguarding data and maintaining system performance. Whether used as part of routine maintenance or in response to specific issues, these tools play a vital role in keeping Linux systems running smoothly and reliably.

1 - 🖥️btrfs

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the btrfs command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#  ██████╗ ████████╗██████╗ ███████╗███████╗
#  ██╔══██╗╚══██╔══╝██╔══██╗██╔════╝██╔════╝
#  ██████╔╝   ██║   ██████╔╝█████╗  ███████╗
#  ██╔══██╗   ██║   ██╔══██╗██╔══╝  ╚════██║
#  ██████╔╝   ██║   ██║  ██║██║     ███████║
#  ╚═════╝    ╚═╝   ╚═╝  ╚═╝╚═╝     ╚══════╝

# Create a btrfs file system on /dev/sdb, /dev/sdc, and /dev/sdd
mkfs.btrfs /dev/sdb /dev/sdc /dev/sdd

# btrfs with just one hard drive, metadata not redundant 
# (this is danegerous: if your metadata is lost, your data is lost as well)
mkfs.btrfs -m single /dev/sdb

# data to be redundant and metadata to be non-redundant:
mkfs.btrfs -m raid0 -d raid1 /dev/sdb /dev/sdc /dev/sdd

# both data and metadata to be redundan
mkfs.btrfs -d raid1 /dev/sdb /dev/sdc /dev/sdd

# To get a list of all btrfs file systems
btrfs filesystem show

# detailed df for a fileesystem (mounted in /mnt)
btrfs filesystem df /mnt

# resize btrfs online (-2g decreases, +2g increases)
btrfs filesystem resize -2g /mnt

# use maximum space
btrfs filesystem resize max /mnt

# add new device to a filesystem
btrfs device add /dev/sdf /mnt

# remove devices from a filesystem
btrfs device delete missing /mnt

# create the subvolume /mnt/sv1 in the /mnt volume
btrfs subvolume create /mnt/sv1

# list subvolumes
btrfs subvolume list /mnt

# mount subvolume without mounting the main filesystem
mount -o subvol=sv1 /dev/sdb /mnt

# delete subvolume
btrfs subvolume delete /mnt/sv1

# taking snapshot of a subvolume
btrfs subvolume snapshot /mnt/sv1 /mnt/sv1_snapshot

# taking snapshot of a file (copy file by reference)
cp --reflink /mnt/sv1/test1 /mnt/sv1/test3

# convert ext3/ext4 to btrfs
btrfs-convert /dev/sdb1

# convert btrfs to ext3/ext4
btrfs-convert -r /dev/sdb1
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

2 - 🖥️diskutil

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the diskutil command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#  ██████╗ ██╗███████╗██╗  ██╗██╗   ██╗████████╗██╗██╗     
#  ██╔══██╗██║██╔════╝██║ ██╔╝██║   ██║╚══██╔══╝██║██║     
#  ██║  ██║██║███████╗█████╔╝ ██║   ██║   ██║   ██║██║     
#  ██║  ██║██║╚════██║██╔═██╗ ██║   ██║   ██║   ██║██║     
#  ██████╔╝██║███████║██║  ██╗╚██████╔╝   ██║   ██║███████╗
#  ╚═════╝ ╚═╝╚══════╝╚═╝  ╚═╝ ╚═════╝    ╚═╝   ╚═╝╚══════╝

# diskutil
# Utility to manage local disks and volumes (Mac OS X)

# List all currently available disks, partitions and mounted volumes:
diskutil list

# Repair the file system data structures of a volume:
diskutil repairVolume /dev/diskX

# Unmount a volume:
diskutil unmountDisk /dev/diskX

# Eject a CD/DVD (unmount first):
diskutil eject /dev/disk1
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

3 - 🖥️dumpe2fs

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the dumpe2fs command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#  ██████╗ ██╗   ██╗███╗   ███╗██████╗ ███████╗███████╗███████╗
#  ██╔══██╗██║   ██║████╗ ████║██╔══██╗██╔════╝██╔════╝██╔════╝
#  ██║  ██║██║   ██║██╔████╔██║██████╔╝█████╗  █████╗  ███████╗
#  ██║  ██║██║   ██║██║╚██╔╝██║██╔═══╝ ██╔══╝  ██╔══╝  ╚════██║
#  ██████╔╝╚██████╔╝██║ ╚═╝ ██║██║     ███████╗██║     ███████║
#  ╚═════╝  ╚═════╝ ╚═╝     ╚═╝╚═╝     ╚══════╝╚═╝     ╚══════╝

# Dump information about ext2/3/4 file systems

# Begins with info on Mount path, Inode count etc.
# Then lists the block group information - free inodes etc.
dumpe2fs /dev/sdb1 | less

# Print the blocks which are reserved as bad in the filesystem
dumpe2fs -b /dev/sda2 

# Use  the block superblock when examining the filesystem
dumpe2fs -o superblock=superblock /dev/sda1 

# Use blocks of blocksize bytes when examining the filesystem.
dumpe2fs -o blocksize=blocksize /dev/sda1 

# Force dumpe2fs to display a filesystem
dumpe2fs -f /dev/sda1 

# Only display the superblock information
dumpe2fs -h 

# Display the filesystem data from an image file created by e2image
dumpe2fs -i 

# Print the detailed group information block numbers in hexadecimal format
dumpe2fs -x 
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

4 - 🖥️export

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the export command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#                ███████╗██╗  ██╗██████╗  ██████╗ ██████╗ ████████╗
#                ██╔════╝╚██╗██╔╝██╔══██╗██╔═══██╗██╔══██╗╚══██╔══╝
#                █████╗   ╚███╔╝ ██████╔╝██║   ██║██████╔╝   ██║   
#                ██╔══╝   ██╔██╗ ██╔═══╝ ██║   ██║██╔══██╗   ██║   
#                ███████╗██╔╝ ██╗██║     ╚██████╔╝██║  ██║   ██║   
#                ╚══════╝╚═╝  ╚═╝╚═╝      ╚═════╝ ╚═╝  ╚═╝   ╚═╝   
                                                                  
                                                                  
																						
#==============================#
# CMD EXPORT
#==============================##==============================#
export LESS='-sCmqPm--Less--(?eEND:%pb\%.)'
# Make less more like more, but still more than more. Percent of file in prompt, etc. 

export LESS="-S -j10 -i"
# This environment variable will invoke 'less' with these options when it is used. Like when viewing a man page.

export HISTSIZE=0
# Life is too short to run the same command twice.

# History in Tag.Monat.Jahr Zeit 
export HISTTIMEFORMAT="%d.%m.%y %T "

export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_CTYPE="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_COLLATE="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_PAPER="en_US.UTF-8"
export LC_NAME="en_US.UTF-8"
export LC_ADDRESS="en_US.UTF-8"
export LC_TELEPHONE="en_US.UTF-8"
export LC_MEASUREMENT="en_US.UTF-8"
export LC_IDENTIFICATION="en_US.UTF-8"
export LC_ALL=en_US.UTF-8

# coloured shell prompt
# This coloured prompt will show: username in green, grey "@" sign, hostname in red, current directory in yellow, typed commands in green.
export PS1="\e[1;32m\u\e[0m@\e[1;31m\h\e[0m\e[1;33m\w:#> \e[1;32m"

# Get streamed FLV from Chrome with lsof
export psid=$(pgrep -f libflashplayer.so); cp /proc/$psid/fd/$(lsof -p $psid | grep eleted | awk {' print $4 '} | sed -e "s/[a-z]//g") saved.flv
# Explanation: first get the process id of the chome browser process which runs the flashplayer export it to a variable to be used later. Then we get in subshell the filedescriptor which is marked deleted and construct the /proc path for the in memory fileimage and copy it to the file named saved.flv
# Limitations: IMPORTANT: only one video should be open to play in chrome

export PROMPT_COMMAND="[ \$(date +%m%d) -eq "0401" ] && sleep 0.\$((\$RANDOM%7 + 1))" 
# April Fool's prep: Put a little random delay in someone's terminal that will activate only on April 1st.

export ROSEPARITYBIT=0

export REPORTTIME=60
# ZSH, the next logical step for any serious *nix sysadmin.
# Say how long a command took, if it took more than 60 seconds.

export BIN=`which nmap` && sudo setcap cap_net_raw,cap_net_admin+eip $BIN && sudo chown root $BIN && sudo chmod u+s $BIN
# Set pcap & SUID Bit for priv. network programs (like nmap)

#==============================##==============================#
# CMD export						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

5 - 🖥️fdisk

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the fdisk command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#                ███████╗██████╗ ██╗███████╗██╗  ██╗
#                ██╔════╝██╔══██╗██║██╔════╝██║ ██╔╝
#                █████╗  ██║  ██║██║███████╗█████╔╝ 
#                ██╔══╝  ██║  ██║██║╚════██║██╔═██╗ 
#                ██║     ██████╔╝██║███████║██║  ██╗
#                ╚═╝     ╚═════╝ ╚═╝╚══════╝╚═╝  ╚═╝

# Show partitions of only physical SCSI/SATA/SCA drives and not other things like device mapper entries. 
fdisk -l /dev/sd?

# delete a partition
fdisk /dev/sda
Command (m for help): d
Partition number (1-9): XXX

#==============================##==============================#
# CMD fdisk						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

6 - 🖥️hd

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the hd command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#  ██╗  ██╗██████╗ 
#  ██║  ██║██╔══██╗
#  ███████║██║  ██║
#  ██╔══██║██║  ██║
#  ██║  ██║██████╔╝
#  ╚═╝  ╚═╝╚═════╝ 

# show hex dump of 20 bytes of /etc/passwd (skip 10 first bytes)
hd -s 10 -n 20 /etc/passwd
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

7 - 🖥️lvcreate

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the lvcreate command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#  ██╗    ██╗   ██╗ ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗
#  ██║    ██║   ██║██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝
#  ██║    ██║   ██║██║     ██████╔╝█████╗  ███████║   ██║   █████╗  
#  ██║    ╚██╗ ██╔╝██║     ██╔══██╗██╔══╝  ██╔══██║   ██║   ██╔══╝  
#  ███████╗╚████╔╝ ╚██████╗██║  ██║███████╗██║  ██║   ██║   ███████╗
#  ╚══════╝ ╚═══╝   ╚═════╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝   ╚═╝   ╚══════╝

# lvcreate

# Creates a logical volume in an existing volume group.
# A volume group is a collection of logical and physical volumes.

# Create a logical volume of 10 gigabytes in the volume group vg1:
lvcreate -L 10G vg1

# Create a 1500 megabyte linear logical volume named mylv in the volume group vg1:
lvcreate -L 1500 -n mylv vg1

# Create a logical volume called mylv that uses 60% of the total space in volume group vg1:
lvcreate -l 60%VG -n mylv vg1

# Create a logical volume called mylv that uses all of the unallocated space in the volume group vg1:
lvcreate -l 100%FREE -n mylv vg1

# Create a snapshot (lvsnap) from a logical volume (/dev/vgA/lv1);
# snapshot size = 10G (total size of the changes)
lvcreate -L 10G -s -n lvsnap /dev/vgA/lv1

# Clone LVM volume: test => testCopy
lvconvert --type mirror --alloc anywhere -m1 /dev/mylv/test
lvs -a -o +devices | egrep "LV|test"
# After Cpy%Sync is 100% finished:
lvconvert --splitmirrors 1 --name testCopy /dev/rootvg/test
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

8 - 🖥️lvextend

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the lvextend command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#  ██╗    ██╗   ██╗███████╗██╗  ██╗████████╗███████╗███╗   ██╗██████╗ 
#  ██║    ██║   ██║██╔════╝╚██╗██╔╝╚══██╔══╝██╔════╝████╗  ██║██╔══██╗
#  ██║    ██║   ██║█████╗   ╚███╔╝    ██║   █████╗  ██╔██╗ ██║██║  ██║
#  ██║    ╚██╗ ██╔╝██╔══╝   ██╔██╗    ██║   ██╔══╝  ██║╚██╗██║██║  ██║
#  ███████╗╚████╔╝ ███████╗██╔╝ ██╗   ██║   ███████╗██║ ╚████║██████╔╝
#  ╚══════╝ ╚═══╝  ╚══════╝╚═╝  ╚═╝   ╚═╝   ╚══════╝╚═╝  ╚═══╝╚═════╝

# lvextend
# Extends a logical volume in an existing volume group.
# A volume group is a collection of logical and physical volumes.

# Extend volume in volume mylv in groug vg0
# (defined by volume path /dev/vg0/mylv)
# to 12 gigabyte:
lvextend -L 12G /dev/vg0/mylv

# Extend volume in volume mylv in groug vg0
# (defined by volume path /dev/vg0/mylv)
# by 1 gigabyte:
lvextend -L +1G /dev/vg0/mylv

# Extend volume in volume mylv in groug vg0
# (defined by volume path /dev/vg0/mylv)
# to use all of the unallocated space in the volume group vg0:
lvextend -L +100%FREE /dev/vg0/mylv

# Extend ext4 filesystem after changing a logical volume
# (takes volume path as parameter):
ext2resize /dev/vg0/mylv

# Extend btrfs filesystem after changing a logical volume
# (takes the mount point as parameter, not the volume path):
btrfs filesystem resize max /mylv

# Extend xfs filesystem after changing a logical volume
# (takes the mount point as parameter, not the volume path):
xfs_growfs /mylv

# Extend jfs filesystem after changing a logical volume
# (takes the mount point as parameter, not the volume path);
# Just remount:
mount -o remount,resize /home
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

9 - 🖥️lvm

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the lvm command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#                ██╗    ██╗   ██╗███╗   ███╗
#                ██║    ██║   ██║████╗ ████║
#                ██║    ██║   ██║██╔████╔██║
#                ██║    ╚██╗ ██╔╝██║╚██╔╝██║
#                ███████╗╚████╔╝ ██║ ╚═╝ ██║
#                ╚══════╝ ╚═══╝  ╚═╝     ╚═╝
                                           
                                           
														 
#Exclusive Activation of a Volume Group in a Cluster 
#Link --> https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/High_Availability_Add-On_Administration/s1-exclusiveactive-HAAA.html 
1> vgs --noheadings -o vg_name
2> volume_list = [ "rhel_root", "rhel_home" ]
3> dracut -H -f /boot/initramfs-$(uname -r).img $(uname -r)
4> Reboot the node
5> uname -r to verify the correct initrd image

#==============================#
# CMD LVM 
#==============================##==============================#
https://thomas-krenn.com/de/wiki/LVM_vergrößern

vgdisplay
lvdisplay
pvdisplay
# LVM's anschauen long

vgs
lgs
pgs
# LVM's anschauen short

lvextend -r --size +10G /dev/vg/opt
# vergrößern mit der option -r resized gleich das filesystem

lvdisplay

swapoff /dev/vg/swap
# swap aus

lvextend -L+1G /dev/vg/swap
mkswap /dev/vg/swap
swapon /dev/vg/swap
# LVM SWAP Vergrössern

pvcreate /dev/sdb /dev/sdc /dev/sdd
# To create physical volumes on top of /dev/sdb, /dev/sdc, and /dev/sdd

lvcreate -n vol_projects -L 10G vg00
# The -n option is used to indicate a name for the LV, whereas -L sets a fixed size and -l (lowercase L) is used to indicate a percentage of the remaining space in the container VG.

mkfs.ext4 /dev/vg00/vol_projects
# create a filesystem on top of it

lvreduce -L -2.5G -r /dev/vg00/vol_projects
# resizing each filesystem

lvextend -l +100%FREE -r /dev/vg00/vol_backups
# resizing each filesystem

vgextend vg00 /dev/sdd
# Adding the remaining PV from our initial setup (/dev/sdd).

blkid /dev/vg00/vol_projects
# to find out what its UUID (a non-changing attribute that uniquely identifies a formatted storage device) is

#==============================##==============================#
# CMD LVM						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

10 - 🖥️ncdu

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the ncdu command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#                ███╗   ██╗ ██████╗██████╗ ██╗   ██╗
#                ████╗  ██║██╔════╝██╔══██╗██║   ██║
#                ██╔██╗ ██║██║     ██║  ██║██║   ██║
#                ██║╚██╗██║██║     ██║  ██║██║   ██║
#                ██║ ╚████║╚██████╗██████╔╝╚██████╔╝
#                ╚═╝  ╚═══╝ ╚═════╝╚═════╝  ╚═════╝ 
                                                   
                                                   
                                                   
# Save results to file
ncdu -o ncdu.file

# Read from file
ncdu -f ncdu.file

# Save results to compressed file 
ncdu -o-| gzip > ncdu.file.gz

# Read from compressed file
zcat ncdu.file.gz | ncdu -f-

#==============================##==============================#
# CMD NCDU						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

11 - 🖥️parted

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the parted command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#  ██████╗  █████╗ ██████╗ ████████╗███████╗██████╗ 
#  ██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██╔══██╗
#  ██████╔╝███████║██████╔╝   ██║   █████╗  ██║  ██║
#  ██╔═══╝ ██╔══██║██╔══██╗   ██║   ██╔══╝  ██║  ██║
#  ██║     ██║  ██║██║  ██║   ██║   ███████╗██████╔╝
#  ╚═╝     ╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝   ╚══════╝╚═════╝ 

# create a new MBR/msdos partition table for BIOS systems
(parted) mklabel msdos

# create a new GPT partition table for UEFI systems instead, use:
(parted) mklabel gpt

# grow a partition
(parted) resizepart ${number} ${end}
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

12 - 🖥️resize2fs

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the resize2fs command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#  ██████╗ ███████╗███████╗██╗███████╗███████╗██████╗ ███████╗███████╗
#  ██╔══██╗██╔════╝██╔════╝██║╚══███╔╝██╔════╝╚════██╗██╔════╝██╔════╝
#  ██████╔╝█████╗  ███████╗██║  ███╔╝ █████╗   █████╔╝█████╗  ███████╗
#  ██╔══██╗██╔══╝  ╚════██║██║ ███╔╝  ██╔══╝  ██╔═══╝ ██╔══╝  ╚════██║
#  ██║  ██║███████╗███████║██║███████╗███████╗███████╗██║     ███████║
#  ╚═╝  ╚═╝╚══════╝╚══════╝╚═╝╚══════╝╚══════╝╚══════╝╚═╝     ╚══════╝

# resize2fs

# ext2/ext3/ext4 file system resizer

# resize filesystem up to the block device size
# make e2fsck /dev/xvdb1 before
# filesystem must be not mounted for ext2
resize2fs /dev/xvdb1

# shrink filesystem (20G is new size)
resize2fs /dev/xvdb1 20G
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

13 - 🖥️tune2fs

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the tune2fs command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#    ████████╗██╗   ██╗███╗   ██╗███████╗██████╗ ███████╗███████╗
#    ╚══██╔══╝██║   ██║████╗  ██║██╔════╝╚════██╗██╔════╝██╔════╝
#       ██║   ██║   ██║██╔██╗ ██║█████╗   █████╔╝█████╗  ███████╗
#       ██║   ██║   ██║██║╚██╗██║██╔══╝  ██╔═══╝ ██╔══╝  ╚════██║
#       ██║   ╚██████╔╝██║ ╚████║███████╗███████╗██║     ███████║
#       ╚═╝    ╚═════╝ ╚═╝  ╚═══╝╚══════╝╚══════╝╚═╝     ╚══════╝
                                                                            
                                                                           

tune2fs -m1 /dev/sda1 
# Reduce the superuser reserved space on a Linux ext[234] filesystem to 1% (default is 5%). This gives you more user space because on a 8TB drive, 4% is enough to hold ~300 HD quality movies. It's recommended not to go below 1% to be safe.

#==============================##==============================#
# CMD tune2fs                                                  #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

14 - 🖥️xfs_repair

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the xfs_repair command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#  ██╗  ██╗███████╗███████╗        ██████╗ ███████╗██████╗  █████╗ ██╗██████╗ 
#  ╚██╗██╔╝██╔════╝██╔════╝        ██╔══██╗██╔════╝██╔══██╗██╔══██╗██║██╔══██╗
#   ╚███╔╝ █████╗  ███████╗        ██████╔╝█████╗  ██████╔╝███████║██║██████╔╝
#   ██╔██╗ ██╔══╝  ╚════██║        ██╔══██╗██╔══╝  ██╔═══╝ ██╔══██║██║██╔══██╗
#  ██╔╝ ██╗██║     ███████║███████╗██║  ██║███████╗██║     ██║  ██║██║██║  ██║
#  ╚═╝  ╚═╝╚═╝     ╚══════╝╚══════╝╚═╝  ╚═╝╚══════╝╚═╝     ╚═╝  ╚═╝╚═╝╚═╝  ╚═╝

# xfs_repair - repair an XFS filesystem 

# rapair a XFS filesystem
xfs_repair /dev/dm-0

# last resort option:
# -L: Force Log Zeroing. zero the log even if it is dirty (contains metadata changes).
# When using this option the filesystem will likely appear to be corrupt,
# and can cause the loss of user files and/or data.
xfs_repair -v -L /dev/dm-0
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░