Combining Two Separate Free Spaces on a Hard Drive
If you're running out of free space on your hard drive, you might have noticed that there are two or more separate free spaces on your drive that you'd like to combine. In this article, we'll cover the steps to combine two separate free spaces on a hard drive, along with some key concepts and considerations to keep in mind.
Key Concepts
Before we dive into the steps, let's cover some key concepts related to hard drive partitions and free space:
- Partition: A partition is a logical division of a hard drive that separates the drive into one or more independent sections. Each partition can be formatted with a different file system and used for different purposes.
- Free Space: Free space is the unallocated space on a hard drive that is not currently being used by any partition or file system. Free space can be used to create new partitions or expand existing ones.
- Extending a Partition: Extending a partition involves adding free space to an existing partition, effectively increasing its size. This can be done manually using a partitioning tool or automatically using a disk management tool.
Combining Two Separate Free Spaces
To combine two separate free spaces on a hard drive, you'll need to use a partitioning tool such as cfdisk or fdisk. Here are the general steps to follow:
- Launch the partitioning tool, such as
cfdisk. - Identify the two separate free spaces that you want to combine. In the example provided in the question, the free spaces are labeled as two separate entries.
- Delete one of the free spaces. This will combine it with the adjacent free space, creating a larger contiguous free space.
- Move the adjacent partition to the beginning of the larger free space, if necessary. This will ensure that the free space is contiguous with the partition that you want to extend.
- Extend the partition to include the larger free space. This will increase the size of the partition and use up the free space.
Here's an example of how this might look using cfdisk:
# cfdisk /dev/sda
Label: gpt
identifier: CEE38D42-DBB8-4F74-ADA6-1BC2A5E46AE1
Device Start End Sectors Size Type
/dev/sda1 2048 1026047 1024000 499M EFI System
/dev/sda2 1026048 1548287 522240 256M Linux filesystem
/dev/sda3 1548288 1677311 129024 63M Linux swap
/dev/sda4 1677312 976768000 975090689 465.3G Linux filesystem
Free space 976768000 976773183 5184 2.5M
Free space 976773184 976778367 5184 2.5M
In this example, we can see two separate free spaces at the end of the drive. To combine them, we would delete the second free space, move the adjacent partition (/dev/sda4) to the beginning of the larger free space, and then extend the partition to include the larger free space. Here's how that might look:
# cfdisk /dev/sda
Label: gpt
identifier: CEE38D42-DBB8-4F74-ADA6-1BC2A5E46AE1
Device Start End Sectors Size Type
/dev/sda1 2048 1026047 1024000 499M EFI System
/dev/sda2 1026048 1548287 522240 256M Linux filesystem
/dev/sda3 1548288 1677311 129024 63M Linux swap
/dev/sda4 1677312 976773183 975095872 465.3G Linux filesystem
Free space 976773184 976778367 5184 2.5M
As you can see, the two free spaces have been combined into a single larger free space, which can now be used to create a new partition or extend an existing one.
Combining two separate free spaces on a hard drive can be done using a partitioning tool such as cfdisk or fdisk. By deleting one of the free spaces and extending the adjacent partition to include the larger free space, you can effectively combine the two separate free spaces into a single larger free space. This can be useful for freeing up space on a hard drive or for creating new partitions.
References
- cfdisk Manual
- fdisk Manual
- How to Use fdisk to Partition Your Hard Drive
- How to Resize a Partition on Linux
Types of references:
- Online resources