In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to delete partitions in Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Managing partitions is a serious business, especially if you have to delete them. I found myself doing this a lot, especially after using USB drives as real-time disks and Linux installers, because they created several partitions that I didn't need later.
In this tutorial, I'll show you how to use the command line and GUI tools to delete partitions in Linux.
Warning!
Delete the partition and you will lose your data. Whenever you are operating a partition, be sure to back up your data. A slight typing mistake or slippery hand can be expensive. Don't say we didn't warn you!
Delete disk partitions using GParted (GUI method)
As a desktop Linux user, you may feel more comfortable and perhaps more secure with GUI-based tools.
There are several tools that let you manage partitions on Linux. Depending on your distribution, one or more of these tools have been installed on your system.
In this tutorial, I will use GParted. It is a popular open source tool that is very simple and intuitive to use.
The first step is to install GParted if it is not already on your system. You should be able to find it in the software center of your distribution.
Alternatively, you can install it using your distribution's package manager. In Linux distributions based on Debian and Ubuntu, you can use the apt install command:
Sudo apt install gparted
After the installation is complete, let's open GParted. Since you are dealing with disk partitions, you need to have root permissions. It will require authentication, and when you open it, you should see a window like this:
In the upper right corner, you can select the disk and select the partition you want to delete below.
Next, select the Delete option from the partition menu:
This process is not complete until you rewrite the partition table. This is a security measure that gives you the option to review changes before confirming.
To do this, simply click the "apply all actions" button located in the toolbar, and then click "apply" when asked for confirmation.
After clicking "apply", you will see a progress bar and a result message saying that all operations have been successful. You can close the message and the main window and assume that your partition has been completely deleted from the disk.
Now that you know how to use GUI, let's continue using the command line.
Delete a partition using the fdisk command (CLI method)
Almost every Linux distribution comes with fdisk by default, and we'll use this tool today. The first thing you need to know is to which device the partition you want to delete is assigned. To do this, enter the following at the terminal:
Sudo fdisk-list
This will print out all the drives and partitions in our system, as well as the assigned devices. You need to have root permission to make it work.
In this example, I will use a USB drive with two partitions, as shown in the following figure:
The device allocated in the system is / sdb, which has two partitions: sdb1 and sdb2. Now that you have determined which device contains these partitions, you can start by using fdisk and the path to the device:
Sudo fdisk / dev/sdb
This starts fdisk in command mode. You can press m at any time to see the list of options.
Next, type p, then press enter to view the partition information and make sure you are using the correct device. If you use the wrong device, you can use the Q command to exit fdisk and start over.
Now type d to delete a partition, which immediately asks for the partition number, which corresponds to the number listed in the "Device" column, which in this case is 1 and 2 (as you can see in the screenshot below), but can and will vary depending on the current partition table.
Let's delete the second partition by typing 2 and pressing enter. You should see a message: "Partition 2 has been deleted", but in fact, it has not been deleted. Fdisk also needs a step to rewrite the partition table and apply these changes. You see, this is the complete net.
You need to type w and press enter to make these changes permanent. No more confirmation was requested.
After that, you should see the following feedback:
Now, using sudo fdisk-- list / dev/sdb to look at the device's current partition table, you can see that the second partition has completely disappeared. You have finished using the terminal and fdisk commands to delete your partition. Succeed!
Summary
This ends the tutorial on how to use terminals and GUI tools to delete partitions in Linux. Remember to always be safe, back up your files before operating the partition, and carefully check that you are using the correct device. Deleting a partition deletes everything in it, with little chance of recovery.
This is the end of "how to delete partitions in Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.