How to repartition root directory?

Posted on

The person who had installed Red hat linux enterprise 8 on our computer for whatever reason partitioned a small amount of space for the root directory /. This is what the partition on the hard drive looks like:

sdb 8:16 0 894.3G 0 disk
├─sdb1 8:17 0 512M 0 part /boot/efi
├─sdb2 8:18 0 3.9G 0 part /boot
├─sdb3 8:19 0 29.3G 0 part /
├─sdb4 8:20 0 3.9G 0 part [SWAP]
└─sdb5 8:21 0 856.7G 0 part /home/scratch

Or using parted:

Model: ATA SSDSC2KG960G8L (scsi)
Disk /dev/sdb: 960GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 538MB 537MB fat32 EFI System Partition boot, esp
2 538MB 4732MB 4194MB xfs
3 4732MB 36.2GB 31.5GB xfs
4 36.2GB 40.4GB 4194MB linux-swap(v1) swap
5 40.4GB 960GB 920GB ext3 primary

As you can see, a /home/scratch folder was created I guess to increase the space we can use in a different folder. This has not been convenient, and I'd like all the space to be combined in the / folder. I'm wondering how to do this. Looking online I can see how parted can resize partitions, but as far as I understand, you'd need to resize based on starting and end position in memory. So if I deleted the /home/scratch partition ( I assume this is the 5 40.4GB 960GB 920GB ext3 primary line), then I'd need to move linux-swap(v1) partition up somehow and then fill in the space between number 3 and 5? I'm confused by this concept, and am hoping to get some hints on how to actually do this.

Responses