Linux CLI 29 ๐ง fsck, mkfs and dd commands
a - fsck command
fsck is used to verify the intergrity of a file system
It checks for error( corrupted inodes, bad sectors, or broken file system structures)
It can attempt to fix those errors
before you check a filesystem you have to unmount it with umount
sudo fsck -N /dev/sda โ displays what it will do without doing anything
sudo fsck /dev/sda โ performs the check
sudo fsck -n /dev/sda โ perform a check but do not repair
sudo fsck -f /dev/sda โ forces a check
-a โ repairs errors automatically -v โ verbose mode -t โ test for bad sectors
b - mkfs command
mkfs โ Make File System
mkfs is used to create and format file systems
write sudo mkfs and use TAB key to show the supported filesystem types
Create a file system on a partition
sudo mkfs -t ext4 /dev/sda or sudo mkfs.ext4 /dev/sda
Note that mkfs creates a new filesystem on existing partition or drive
It does not resize or delete it. For this task you can use fdisk
c - dd command
dd โ Data description
dd is used to copy and convert data from one place to another
syntax โ dd if=inputfile [bs=blocksize] [count=numcopies] Of=outputfile
if โ input file, where to read data from
bs โ sets the block size, default is 512 bytes (optional)
count โ specifies how many blocks will be transferred. All is default (optional)
of โ output file, where the data will be transferred to
d - dd command examples
dd If=input.txt Of=backup.txt โ copy a file
dd If=/dev/sda bs=4M count=10240 of=image.img โ create an image file from /dev/sda
dd If=/dev/sda Of=/dev/sdc โ clone a disk to another
dd if=/dev/sda1 of=~/sda1partition.img โ backup a partition
dd if=sda1partition.img of=/dev/sda1 โ restore the previous backup
and if you need to create an CD-ROM ISO
dd if=/dev/cdrom of=tgsservice.iso bs=2048
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!