du -h --max-depth=1
Use the following commands to view disk space, partitions, and layouts:
df -hT # View disk usage with filesystem types
lsblk # List block devices
fdisk -lu # Detailed partition table (MBR)
sfdisk -l # Alternative partition listing- Create the Swap Partition using
parted:
parted > unit s # Use sectors for units
> print free # Show available space
> mkpart primary swap-partition <start-sector>s 100%
- Initialize the Swap Area:
swapon /dev/sdaX- Enable the Swap:
swapon /dev/sdaX- Verify Swap Status:
swapon --show
- Make Swap Permanent:
- Get the UUID of the swap partition:
blkid
- Edit
/etc/fstaband add:
`UUID=<swap-partition-uuid> none swap sw 0 0`
- Turn Off the Swap:
swapoff /dev/sdX
- Verify:
swapon --show
- Delete the Partition:
parted
> print free
> rm <partition-number>`
- Resize with
parted:
parted
> print free
> resizepart <partition-number> 100%
- Resize the filesystem inside the partition
resize2fs /dev/sdX
- Verify
df -h