Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Keeping track of disk usage and health is crucial for preventing data loss and ensuring efficient storage management.

     1. df -h # Shows disk space usage in "human-readable" format

Code Block
languagebash
themeMidnighttitleCommands
    df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.8G     0  3.8G   0% /dev
tmpfs           783M  1.7M  781M   1% /run
/dev/sda2       233G   25G  197G  12% /
tmpfs           3.9G   39M  3.8G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           783M   80K  783M   1% /run/user/1000

    2. du -sh /path/to/directory  Displays the size of a specific directory.

Code Block
languagebash
themeMidnight
titleCommands
   du -sh /path/to/directory 
1.1G    /path/to/director

 # Shows disk space usage.
    du -sh /path/to/directory # Displays the size of a specific directory.
    fdisk -l # Lists all partitions.
    smartctl -a /dev/sda # Checks the health of a disk (requires smartmontools).
    iostat # Reports CPU and I/O statistics.

   3. fdisk -l  # List all partitions

Code Block
languagebash
themeMidnight
titleCommands
   fdisk -l
Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
Disk model: QEMU HARDDISK    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: XXXXXX-XXX-XXX-XXXX-XXXXXXXXXX

Device     Start      End  Sectors Size Type
/dev/sda1   2048     4095     2048   1M BIOS boot
/dev/sda2   4096 41940607 41936512  20G Linux filesystem


Div
classtitle-box

Process and Service Management

...