# Disk Management

| Command                                                             | Description                                               | Example                                                                 |
| ------------------------------------------------------------------- | --------------------------------------------------------- | ----------------------------------------------------------------------- |
| <mark style="color:red;">**lsblk**</mark>                           | List information about block devices (disks, partitions). | lsblk → Displays block devices and their mount points.                  |
| <mark style="color:red;">**fdisk**</mark>                           | Partition table manipulator for Linux.                    | sudo fdisk -l → Lists all partitions on all devices.                    |
| <mark style="color:red;">**mount \[device] \[mount\_point]**</mark> | Mount a file system to a directory.                       | sudo mount /dev/sda1 /mnt → Mounts /dev/sda1 to \* /mnt\*.              |
| <mark style="color:red;">**umount \[mount\_point]**</mark>          | Unmount a file system.                                    | sudo umount /mnt → Unmounts \* /mnt\*.                                  |
| <mark style="color:red;">**chroot**</mark>                          | Change the root directory for the current process.        | sudo chroot /mnt → Changes root to \* /mnt\*.                           |
| <mark style="color:red;">**resize2fs**</mark>                       | Resize ext2/ext3/ext4 file systems.                       | sudo resize2fs /dev/sda1 → Resizes the file system on \* /dev/sda1\*.   |
| <mark style="color:red;">**fsck**</mark>                            | File system consistency check.                            | sudo fsck /dev/sda1 → Checks and repairs file system on \* /dev/sda1\*. |
| <mark style="color:red;">**swapoff**</mark>                         | Disable swapping on devices.                              | sudo swapoff /dev/sda2 → Disables swapping on \* /dev/sda2\*.           |
| <mark style="color:red;">**swapon**</mark>                          | Enable swapping on devices.                               | sudo swapon /dev/sda2 → Enables swapping on \* /dev/sda2\*.             |
| <mark style="color:red;">**mount -o loop \[iso] \[dir]**</mark>     | Mount an ISO file as a loop device.                       | sudo mount -o loop image.iso /mnt → Mounts image.iso to \* /mnt\*.      |
| <mark style="color:red;">**lsof**</mark>                            | List open files and processes using them.                 | lsof → Lists all open files and the processes using them.               |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devops-3.gitbook.io/devops/docs/linux-cheat-sheet/disk-management.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
