Partition Deletion With fdisk Command On Linux Machine

Muhammed Eren Demir
3 min readJun 17, 2021

Partition management is a serious issue, especially when it comes to removing them.

Photo by Blake Connally on Unsplash

Türkçe okumak için lütfen linke tıklayınız. https://muhammederendemir.com/fdisk-partition-silme/

Greetings, I’m using LVM for disk management on Linux systems. While using LVM, I created an extra partition and had to delete it. I was able to delete the disk I created with the fdisk command.

⚒️ What should we do to wipe disk?

You need to use the fdisk command. Before typing any of the commands below, make sure you have a backup of important data. So how is this document, where did I go wrong, I was not going to erase this disk. Don’t say, I’ve been warned.👊🏼

Let’s type the following command to get a list of our partition schema

fdisk -l

Output:

author

In the output above we have a hard disk

/dev/sda

Let’s say we want to remove the /dev/sda partition from disk. Let’s type the following command:

fdisk /dev/sda

Output:

author

Type the p command to list partitions:

Command (m for help): p

Output:

author

Let’s come to the partition deletion process, let’s want to delete the /dev/sda3 partition. Let’s write the d command to delete a partition.

After the d command, it will ask us to enter a partition number to be deleted.

Command (m for help): d
Partition number (1-3): 3

so what happened? is it deleted now? yes, let’s check by listing the partitions are they deleted? 🤔

Command (m for help): p

Output:

author

I don’t see /dev/sda3 in the list, our deletion seems to be successful. 🙃

We have come to our last transaction that we should not forget. After saving the changes, let’s exit the fdisk shell system. We save the changes with the w command.

Command (m for help): w

We can use it by restarting our machine.

https://cdn-images-1.medium.com/max/1000/0*_6UQ4Mn5-vCh3c3i.gif

Thank you for reading!

--

--

Muhammed Eren Demir

I am software developer. I'm improving myself on Java and devops. I'm working java and devops software in DetaySoft.