[linux] Ubuntu system hard disk operation: create and delete disk partitions, change disk partition types, delete disk signatures

1. View all disk information on the server

fdisk -l 

2. Delete the partition

fdisk /dev/sdc
d
# 输入要删除的分区id号,我这只有1个分区,所以自动删除了partition 1
w

Insert image description here

3. Change the disk partition table type

3.1 Introduction to disk partition types

Insert image description here

  • gpt
  • of the
  • FAT
parted /dev/sdc
# mklabel gpt或者mktable gpt
mktable gpt

Insert image description here

4. Convert the disk to a raw disk or a brand new disk (delete all information such as disk signature, partition table, etc.)

4.1 Raw disk introduction

Insert image description here
Execute the command on the raw disk: fdisk /dev/sdd, this command will automatically set the disklabel and disk identifier for the raw disk , which will write the signature information to the disk .
Insert image description here
The disk is no longer clean and is not a raw disk. Enter pto view the disk information, and found that there are indeed more disklabels and disk identifiers
Insert image description here
, but this is only temporarily written, directly enter and qexit, and use fdisk -lView to find that /dev/sdd is still a raw disk.
But if you enter the command w, the signature information will actually be written and it will automatically exit. If you fdisk -lcheck it, you will find that /dev/sdd is not a raw disk.
Insert image description here
There are really more disk information, disklabel and disk identifier.
Insert image description here

4.2 Turn into a raw disk

wipefs -a -f /dev/sdd

Insert image description here
If you fdisk -lcheck it, you will find that /dev/sdd is a raw disk again.
Insert image description here
Reference article: wipefs, dd and clearpart clear partitions

Guess you like

Origin blog.csdn.net/weixin_43693967/article/details/128035865