> For the complete documentation index, see [llms.txt](https://ghoulsec.gitbook.io/ghoulsec-vault/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ghoulsec.gitbook.io/ghoulsec-vault/server-are-fun/managing-partitions/parted.md).

# Parted

The `parted` tool is a command-line utility in Linux used for managing disk partitions. It allows users to create, resize, delete, and modify partitions on hard drives or other storage devices. Unlike older tools like `fdisk`, `parted` supports larger disk sizes (over 2TB) and works with various partitioning schemes like GPT (GUID Partition Table) and MBR (Master Boot Record). It's a powerful tool for partition management, especially when dealing with advanced features like resizing partitions without losing data or creating partitions with different file systems.

***

#### Accessing parted&#x20;

Parted command can be opened following by entering the target disk to take action on , Replace `xxx`  with the target file system in you case

{% code overflow="wrap" %}

```bash
sudo parted /dev/xxx
```

{% endcode %}

We can access the help page inside the pathed console by typing `help` & the outupt should look like :&#x20;

<figure><img src="https://2332860236-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq6mjlFfyDOi3mV0lemKE%2Fuploads%2FusQJnKqdAX0c7wlF9tbb%2Fimage.png?alt=media&amp;token=e0aee45d-caa2-4632-bf8f-26aa59954ce8" alt=""><figcaption></figcaption></figure>

***

These commands provide a versatile set of tools for disk partitioning and management, offering functionality for creating, resizing, and adjusting partitions on Linux-based systems.

1. **align-check TYPE N**: Check partition `N` for alignment (`min` or `opt`).\
   Example: `align-check min 1`.
2. **help \[COMMAND]**: Show help for a command.\
   Example: `help mkpart`.
3. **mklabel,mktable LABEL-TYPE**: Create a new partition table (e.g., `gpt`, `msdos`).\
   Example: `mklabel gpt`.
4. **mkpart PART-TYPE \[FS-TYPE] START END**: Create a partition.\
   Example: `mkpart primary ext4 0% 50%`.
5. **name NUMBER NAME**: Name a partition.\
   Example: `name 1 "Data"`.
6. **print \[devices|free|list,all|NUMBER]**: Display partition table or free space.\
   Example: `print`.
7. **quit**: Exit `parted`.
8. **rescue START END**: Recover a lost partition near `START` and `END`.\
   Example: `rescue 100MB 200MB`.
9. **resizepart NUMBER END**: Resize partition `NUMBER` to `END`.\
   Example: `resizepart 1 100GB`.
10. **rm NUMBER**: Delete partition `NUMBER`.\
    Example: `rm 1`.
11. **select DEVICE**: Select a device to edit.\
    Example: `select /dev/sda`.
12. **disk\_set FLAG STATE**: Set a flag (e.g., `boot`) on the device.\
    Example: `disk_set boot on`.
13. **disk\_toggle \[FLAG]**: Toggle a flag on the device.\
    Example: `disk_toggle boot`.
14. **set NUMBER FLAG STATE**: Set a flag on partition `NUMBER`.\
    Example: `set 1 boot on`.
15. **toggle \[NUMBER \[FLAG]]**: Toggle a flag on a partition.\
    Example: `toggle 1 boot`.
16. **unit UNIT**: Set size unit (e.g., MB, GB).\
    Example: `unit MB`.
17. **version**: Display `parted` version.\
    Example: `version`.
