How Delete All Partitions and Format It Again in Linux
Your difficult drive is usually partitioned into logical volumes called partitions. Partitions help you organize your information and hence allow yous to easily retrieve your saved files and folders. You tin easily create partitions to brand space for data storage as well every bit delete them.
In that location are 2 ways you can delete a division in Linux:
- Using the fdisk command-line utility
- Using the Gparted GUI tool
Delete a Division Using the fdisk Control-line Tool
The fdisk command-line utility is a tool that ships with every Linux distribution and comes in handy when you want to create or delete hard deejay partitions.
Usually, partitions take naming conventions, equally shown below:
For IDE drives: /dev/hdx due east.k /dev/hda , /dev/hdb, /dev/hdc
For ISCI disks: /dev/sdx eastward.g /dev/sda, /dev/sdb, /dev/sdc
Before deleting a division, it is imperative that you dorsum upwards all the files and directories since they are going to be wiped out.
In my system, I accept attached a removable bulldoze, /dev/sdb, with two partitions. To display the partitions, I volition execute the fdisk command as shown. If you are using a regular user, ensure to use the sudo command since fdisk requires elevated privileges.
$ sudo fdisk -l | grep sdb
Alternatively, you can use the lsblk command to get a amend visual as follows:
The bulldoze has two partitions: /dev/sdb1 and /dev/sdb2. I'm going to delete the second partition, which is /dev/sdb2.
To get started, invoke the fdisk control-line tool:
Next, you will exist prompted to enter a command to keep. Blazon 'P' to print the existing partitions on the drive.
Command (m for aid): p
To remove the partition, type the letter 'd' which stands for delete and
Press "ENTER".
Command (thousand for help): d
Thereafter, provide the sectionalization number. In my case, I will type 2 and printing "ENTER" since this is the sectionalization that I intend to delete.
Partitioning number (1, 2, default 2): 2
Yous volition be notified that the partition has been removed or deleted. Y'all tin cross-check by printing out the partitions again by typing the p control.
At the bottom of the snippet beneath, only /dev/sdb1 is listed.
To relieve changes to the disk, blazon w for write and press "q" to quit the fdisk shell.
As before, confirm the existing partitions using the fdisk tool.
$ sudo fdisk -l | grep sdb
Delete a Partitioning Using the GParted Tool
Gparted is a powerful graphical tool that allows you to view, resize, create and delete your partitions. It is open-source and admittedly complimentary and can be installed as follows:
For Debian/Ubuntu Distributions
For Debian/Ubuntu distros, run the command below to install Gparted:
$ sudo apt install gparted
For CentOs
For CentOS-based systems, first, install EPEL. Then install Gparted using the yum bundle manager:
$ sudo yum install epel-release
$ sudo yum install gparted
For Arch
For Curvation and Arch-based distros, invoke:
To launch Gparted, run the following command on the last:
Also, y'all tin can apply the awarding manager to search and launch the GUI utility.
Provide your password to authenticate and striking "ENTER".
Once authenticated, Gparted will nowadays the partitions on the master hard drive on which Linux is installed, in my case, it's /dev/sda.
Since the partition to be deleted is located on the removable drive, which is not listed, nosotros volition switch to that hard drive.
To do so, we volition go to Gparted > Devices > /dev/sdb
We now have the partitions of the 2nd hard bulldoze listed, equally shown below:
To delete the 2d partition (/dev/sdb2), we volition unmount it first. So, right-click and select "unmount".
Next, correct-click on the /dev/sdb2 partition, and select the "delete" pick, which ultimately removes or deletes the partition.
Immediately, you will realize that the partition is labeled "Unallocated" and at the bottom left corner of the Gparted window, y'all volition notice an warning informing you of a pending operation. The reason you are getting this is that we have non saved the changes to the disk.
Click on the checkmark, as indicated, to apply the changes made.
When prompted whether to go along with the pending operations, click on "Apply".
Ultimately, the writing process will conclude and the changes saved. Click on the "close" button.
Determination
We have covered two ways that you can employ to delete a logical division in Linux: fdisk utility and Gparted GUI tool. If you notice this informative, send us a like and share this guide.
Source: https://linuxhint.com/delete-a-partition-in-linux/
0 Response to "How Delete All Partitions and Format It Again in Linux"
Post a Comment