What happens when a partition is deleted?

A disk partition is a section of a hard disk or other secondary storage device that is formatted to contain files and folders independently from other partitions. Some reasons why someone may want to delete a partition include:

  1. To resize an existing partition and expand it to use the newly freed up space.
  2. To remove an unused partition and reallocate all its space to another partition.
  3. To get rid of a partition with an outdated or problematic file system.
  4. To erase all data on a partition before selling or disposing of a storage device.

Deleting a partition removes the partition entry from the partitioning scheme and makes the space it occupied available for new partitions or to expand existing ones. However, deleting a partition does not securely erase the data stored on it.

Partition Table

The partition table is a critical data structure that provides information about the partitions on a storage device (Wikipedia, 2022). It resides in the first sector of a drive and contains entries detailing each partition, including the starting and ending addresses, size, type, and other attributes. The partition table acts like a map, allowing the operating system to locate and access the individual partitions.

Without a partition table, the operating system would not know where the partitions start and end on the drive. It relies on the partition table to navigate the different partitions and interact with the file systems contained within them (Minitool, 2022). The role of the partition table is analogous to the table of contents in a book – it provides a layout and guide to the contents stored on the disk.

There are two main types of partition tables – the Master Boot Record (MBR) used on older systems, and the GUID Partition Table (GPT) used on newer systems. Both store the critical mapping information to locate partitions, just in different formats (Wondershare, 2022).

File System

A file system is a method of organizing and storing files on a partition so that they can be easily located and accessed. The file system keeps track of where files are located on the partition by mapping the physical location of the data on the disk to file paths used by the operating system and applications File System vs. Partition: Popular Digital Storage 100% ….

Common file systems include FAT32, NTFS, HFS+, and ext4. When a partition is formatted with a file system, the file system creates a table that maps file paths and names to the sectors where the data is physically stored on the disk. This allows the operating system to locate files by following the file path rather than having to know the physical disk address Disk partitioning.

For example, the file system might map the file path /Users/Documents/Resume.doc to physical sectors 123456-123460 on the hard drive. This abstraction allows files to be accessed by name while enabling the file system to manage where data is physically stored behind the scenes.

Unmounting

Before a partition can be deleted, it must first be unmounted. Unmounting a partition detaches it from the directory structure, allowing the partition to be safely modified or deleted without impacting any processes using files on that partition.

On Linux, the easiest way to unmount a partition is to use the “umount” command. For example, to unmount the “/dev/sdb1” partition, you would run:
umount /dev/sdb1
According to the DevConnected article “How To Mount and Unmount Drives on Linux,” the umount command detaches the partition from the filesystem so it can be safely modified without affecting running processes. https://devconnected.com/how-to-mount-and-unmount-drives-on-linux/

If the partition is busy and cannot be unmounted, the “fuser” command can be used to identify any processes using files on that partition. Once identified, those processes can be stopped or killed, allowing the partition to be unmounted. The Cyberciti article “How do I forcefully unmount a Linux disk partition?” provides examples of using fuser and kill commands to forcibly unmount a busy partition. https://www.cyberciti.biz/tips/how-do-i-forcefully-unmount-a-disk-partition.html

Unmounting the partition prior to deletion ensures no processes will be disrupted and data will not be corrupted.

Deleting the Partition

When you delete a partition in Windows, the operating system removes information about that partition from the partition table so it is no longer recognized. The partition table, also called the master boot record (MBR), contains information about each partition on the hard drive including the size, location, file system, and other details.

To delete a partition, you can use the Disk Management utility, PowerShell cmdlets like Remove-Partition, or the diskpart command line tool in Command Prompt. All of these methods instruct the operating system to overwrite the entry for that partition in the partition table.

For example, the diskpart tool has a “delete partition” command that removes the partition information from the partition table so it no longer appears in Disk Management or File Explorer. The space previously allocated to that partition becomes unallocated disk space (Source).

The partition and any data on it are not immediately erased. The partition information is simply removed from the table so it can no longer be accessed. The operating system acts as if that portion of the disk is now unallocated space available for new partitions (Source).

Disk Space

Deleting a partition frees up the disk space that was previously allocated to that partition [1]. The space is returned to the overall free space available on the disk. For example, if you have a 500 GB hard drive with a 100 GB partition, deleting that partition will increase the free space on the drive from 400 GB to 500 GB. The space is then available to be used by existing partitions or to create new partitions.

Deleting unnecessary partitions is one way to free up disk space on a drive that is getting full. Other common ways to free up space include [2]:

  • Deleting unnecessary files
  • Uninstalling unused applications
  • Moving data off the drive to external storage
  • Enabling storage optimization features like compression

However, deleting a partition permanently removes all data stored on that partition. So it’s important to back up any needed data first before deleting a partition to recover its space.

Data Recovery

Data on a deleted partition may still be recoverable because deleting a partition does not actually erase the data, it only removes the partition table information telling the operating system where the partition is located. The original data still resides on the hard drive until it is overwritten by new data (Source: https://www.acronis.com/en-us/blog/posts/partition-recovery/).

Therefore, recovery software can scan the drive and rebuild the partition table to restore access to the files. As long as the space on the drive has not been reallocated and overwritten, data recovery software has a good chance of recovering the deleted data (Source: https://answers.microsoft.com/en-us/windows/forum/all/deleted-partition-on-hdd-how-do-i-restore-it-and/f7b6f9f4-ef63-41be-b270-cf2fa98c57d0). Some popular data recovery software options include TestDisk, Recuva, and EaseUS Data Recovery Wizard (Source: https://www.easeus.com/data-recovery/recover-lost-partition.html).

Secure Deletion

When deleting a partition, the data is not actually erased right away. The partition table is simply updated to mark the space as available for new data. This means the original data still resides on the disk until it is overwritten by something else. For most people, this is not an issue. But for those concerned about securely erasing sensitive data, special methods should be used.

One secure deletion method is to fill the partition with random data before deleting it. This overwrites the existing data and makes it unrecoverable. On Windows 10 and 11, the cipher command can be used to securely overwrite free space or entire drives.

Another option is to use third party disk wiping software that complies with standards like DoD 5220.22-M to completely sanitize the disk. This performs multiple overwrite passes to ensure data cannot be recovered. Some paid tools also provide verification of the wiping process.

For those concerned about security, enabling full disk encryption is another way to protect data. When the encrypted partition is deleted, the encryption key is destroyed, rendering the data unreadable.

Creating New Partitions

Once a partition is deleted, the space it previously occupied becomes unallocated space on the hard drive. This freed up space can then be used to create new partitions as needed.

There are a couple ways to go about creating new partitions in the newly available space:

Using Disk Management in Windows – Disk Management is a built-in Windows tool that provides a graphical interface for managing disks and volumes. After deleting a partition, the unallocated space will show up in Disk Management. You can right-click on the unallocated space and choose to create a new partition. You can specify the size, drive letter, file system, and other options.

Using the command line – On Windows, the diskpart command can be used to clean and create new primary partitions, logical drives, and volumes in the command line interface. The basic steps are to select the disk, clean it to create unallocated space, create a new partition specifying size, and then format it. [1]

Third party tools – There are many third party partition managers available that provide an interface for creating partitions. These tools often have added capabilities compared to the built-in Windows tools.

The main advantage of deleting a partition is being able to reuse that space for new partitions. This allows you to change the layout and structure of your hard drive partitions as needed.

Conclusion

In summary, deleting a partition removes its entry from the partition table and marks all the data on that partition as free space. The actual data is not immediately erased, but remains on the disk until it gets overwritten by new data. While the data may still be recoverable after deleting a partition, it becomes increasingly difficult over time.

There are several reasons you may want to delete a partition. It allows you to change the partition layout, remove unwanted partitions from the past, or reclaim disk space. When installing a new OS, deleting existing partitions lets you create a blank slate. For security, you can use partition deletion together with a secure overwrite tool.

Overall, partition deletion is a common task that gives you more control over your hard drive layout. By understanding what happens behind the scenes, you can safely delete partitions while minimizing the risk of data loss.