0

I'm looking on my Debian 11 Server for the easiest way to allocate 100GB of extra space after the /dev/sda1 device in command line.

The sda1 partition is almost full and needs to be resize with the unallocated space.

Here is the structure of my hard drive:

Disk: /dev/sda Size: 200 GiB, 214748364800 bytes, 419430400 sectors Label: dos, identifier: 0xea1313af Device Boot Start End Sectors Size Id Type >> /dev/sda1 * 2048 192940031 192937984 92G 83 Linux /dev/sda2 192942078 209713151 16771074 8G 5 Extended └─/dev/sda5 192942080 209713151 16771072 8G 82 Linux swap / Solaris Free space 209713152 419430399 209717248 100G Partition type: Linux (83) │ │ Attributes: 80 │ │Filesystem UUID: b4804667-c4f3-4915-a95d-d3b83fac302c │ │ Filesystem: ext4 │ │ Mountpoint: / (mounted) 

Could you help me to easily achieve this in command line? Thanks! Best regards

2 Answers 2

2

The free space is not directly after the sda1 partition so you can't use it, you need to remove (or move, but removing is easier) the swap partition sda5.

  1. Stop the swap using swapoff /dev/sda5
  2. Remove the sda5 partition and the sda2 extended partition.
  3. Resize the sda1 partition. Don't forget to resize the filesystem too using resize2fs. You can check this question for more details about resizing partitions using fdisk.
  4. Create a new swap partition (optionally a logical one inside a new extended partition if you want setup similar to your current one).
  5. Update your /etc/fstab swap record with the new partition number or UUID.
1
  • 2
    Backups first! Booting from a LiveCD second! Commented Oct 12, 2021 at 9:45
0

I finally managed to do it with a live ISO CD from GParted:

Disk: /dev/sda Size: 200 GiB, 214748364800 bytes, 419430400 sectors Label: dos, identifier: 0xea1313af Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 393215999 393213952 187.5G 83 Linux /dev/sda2 393216000 419430399 26214400 12.5G 5 Extended └─/dev/sda5 393218048 419428351 26210304 12.5G 82 Linux swap / Solaris 

Thanks a lot for your help!

Best, Victor

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.