hexdefender
Email
  • Introduction to Linux
    • Overview
    • Linux Kernel
    • Linux Distros
    • Introduction to Kali Linux
    • Install Kali on VirtualBox
    • Install Kali on AWS
  • Linux Commands
    • Linux File Systems
    • Basic File and Directory commands
    • File Permissions and Ownerships
    • System Commands in Linux
    • Text Processing Commands in Linux
    • Linux Archive Utility
    • Package Management in Kali Linux
    • Networking Commands
    • Disk Utility Tools
    • Linux List of CLI Command lookup
    • Linux CLI Cheatsheet
    • Assignment
  • Networking Essentials
    • Overview
    • Networking Protocols
    • IP Addressing & Subnetting
    • DNS and DNS Security
    • Network Devices and Architecture
    • VPNs and Secure Tunnels
    • Network Address Translation (NAT) & Port Forwarding
    • Wireless Networks & Protocols
    • Cloud Networking & Security
    • Common Network Tools
  • Bash Scripting
    • Fundamentals of Bash
    • Variables, Branching and Loops
    • System Variables in Bash
    • Functions and Error Handling in Bash Scripts
    • File Handling and Text Processing
    • 5 Useful Bash Scripts for Everyday Tasks
    • Useful Assignments
  • Fundamentals of Cybersecurity
    • Introduction to Cybersecurity
    • Importance of Cybersecurity
    • Important Cybersecurity Frameworks
    • Cybersecurity Roles and Career Options
  • Penetration Testing
    • Reconnaissance and Footprinting
    • Exploitation Techniques
      • Introduction
      • Service Enumeration
      • Password Attacks
      • Exploit Discovery
      • The Art of Exploitation
      • The Pentester's guide to Metasploit
    • Post Exploitation - Malware & Escalation
  • Web Application Security
    • Common Web Vulnerabilities
    • OWASP Top 10
    • SQL Injections
    • Cross Site Scripting Attacks
    • Web Application Firewalls
    • Secure Coding Practices
  • Cryptography
    • Basic concepts of cryptography
    • Examples of Asymetric & Hashing functions
    • Public Key Infrastructure
    • Digital Signatures
    • Symmetric and Asymmetric Encryption
  • Social Engineering
    • Introduction to Social Engineering
    • Mitigation Strategies for Social Engineering
  • Digital Forensics
    • Digital Forensics Basics
    • Forensics Tools and Techniques
    • Reverse Engineering Fundamentals
    • Malware Analysis
Powered by GitBook
On this page
  1. Linux Commands

Disk Utility Tools


Chapter 8: Disk Utility Tools and File System Management in Kali Linux

Overview

Disk utility tools are essential for managing storage devices and file systems in a Linux environment. They allow users to perform operations such as creating, deleting, resizing partitions, and mounting or unmounting file systems. This chapter will cover various disk utility tools, their usage, and detailed explanations of mounting and unmounting processes.


1. Disk Utility Tools

These tools are used to manage disk partitions, file systems, and disk-related tasks.

1.1 fdisk

Overview: fdisk is a command-line utility used to create, delete, and manage disk partitions.

Common Usage:

  • List Partitions on a Disk:

    sudo fdisk -l
  • Create a New Partition:

    sudo fdisk /dev/sda

    Follow the interactive prompts to create a partition.

Example Usage: To delete a partition:

  1. Start fdisk:

    sudo fdisk /dev/sda
  2. Type d to delete a partition and follow the prompts.

1.2 parted

Overview: parted is a powerful command-line tool for managing disk partitions, especially for larger disks.

Common Usage:

  • Start Parted on a Disk:

    sudo parted /dev/sda
  • Create a New Partition:

    (parted) mkpart primary ext4 1GB 2GB

Example Usage: To resize a partition:

(parted) resizepart 1 50GB

1.3 mkfs

Overview: mkfs (make file system) is used to create a file system on a partition.

Common Usage:

  • Create an Ext4 File System:

    sudo mkfs.ext4 /dev/sda1
  • Create a FAT32 File System:

    sudo mkfs.vfat /dev/sdb1

Example Usage: To create a new ext4 file system:

sudo mkfs.ext4 /dev/sda1

1.4 mount

Overview: The mount command is used to attach file systems to the Linux file hierarchy.

Common Usage:

  • Mount a Partition:

    sudo mount /dev/sda1 /mnt
  • Mount with Options:

    sudo mount -o rw,relatime /dev/sda1 /mnt

Example Usage: To mount a USB drive:

sudo mount /dev/sdb1 /media/usb

2. Mounting and Unmounting File Systems

Mounting and unmounting are critical operations for managing storage devices in Linux.

2.1 Mounting a File System

Overview: Mounting a file system makes it accessible to the system and allows users to read from and write to it. This process involves associating a file system stored on a storage device with a directory in the file system hierarchy.

Basic Command:

sudo mount [OPTIONS] <device> <mount_point>

Example Command: To mount a partition:

sudo mount /dev/sda1 /mnt/data

Common Mount Options:

  • -o rw: Mount the file system in read-write mode.

  • -o ro: Mount the file system in read-only mode.

  • -o user: Allow a non-root user to mount the file system.

  • -o noexec: Do not allow execution of binaries on the mounted file system.

Example Usage: To mount an ISO image:

sudo mount -o loop /path/to/image.iso /mnt/iso

2.2 Unmounting a File System

Overview: Unmounting a file system detaches it from the file system hierarchy, making it inaccessible. This is essential to ensure data integrity before removing a storage device.

Basic Command:

sudo umount <mount_point>

Example Command: To unmount a partition:

sudo umount /mnt/data

Common Issues When Unmounting:

  • Device is Busy: If a device cannot be unmounted, it may be in use by processes. You can check which processes are using it with:

    lsof /mnt/data
  • Forced Unmount: If you are certain no data will be lost, you can force unmount a device:

    sudo umount -l /mnt/data

3. Disk Usage Tools

These tools help monitor disk usage and identify which files are consuming space.

3.1 df

Overview: The df command displays disk space usage for file systems.

Common Usage:

  • Display Disk Usage:

    df -h
  • Display Specific File System:

    df -h /mnt/data

Example Usage: To view available space:

df -h

3.2 du

Overview: The du command summarizes disk usage of files and directories.

Common Usage:

  • Display Disk Usage for Current Directory:

    du -sh *
  • Display Detailed Disk Usage:

    du -h /path/to/directory

Example Usage: To find the size of a specific folder:

du -sh /var/log

Conclusion

This chapter has provided a comprehensive overview of disk utility tools and file system management in Kali Linux. Understanding how to manage disks, mount and unmount file systems, and monitor disk usage is crucial for effective system administration and troubleshooting.


References

  1. Man Pages for Commands: Use man <command> (e.g., man fdisk, man mount) for detailed command options.

PreviousNetworking CommandsNextLinux List of CLI Command lookup

Last updated 8 months ago

Linux Disk Management Guide:

Kali Linux Documentation:

Linux Command Cheat Sheets:

Linux Documentation Project
Kali Linux Documentation
Linux Cheat Sheet