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--
Editor to share with you how to use sgdisk in linux to manage partitions, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
You only need to know the following six parameters to use most of the basic functions of sgdisk:
1.-p print partition table:
# sgdisk-p / dev/sda
2.-d x delete partition x:
# sgdisk-D1 / dev/sda
3.-n x:y:z creates a new partition numbered x, starting with y and ending with z:
# sgdisk-n 1:1MiB:2MiB / dev/sda
4.-c xpury change the name of partition x to y:
# sgdisk-c 1:grub / dev/sda
5.-t xpury changes the type of partition x to y:
# sgdisk-t 1:ef02 / dev/sda
6.-list-types lists the partition type code:
# sgdisk-list-types
As you can see in the example above, most commands require that the device file name of the hard disk to be operated be specified as a parameter.
You can combine the above parameters so that you can define all the partitions at once:
# sgdisk-n 1:1MiB:2MiB-t 1:ef02-c 1:grub / dev/sda
You can specify relative values for some fields by adding a + or-symbol before the value. If you use relative values, sgdisk will do math for you. For example, the above example can be written as follows:
# sgdisk-n 1:1MiB:+1MiB-t 1:ef02-c 1:grub / dev/sda
The 0 value has special significance for the following fields:
For the partition number field, 0 means that the next available number should be used (the number starts at 1).
For the starting address field, 0 means to use the header of the available free block. Some space at the beginning of the hard disk is always reserved for the partition table itself.
For the end address field, 0 means to use the end of the available free block.
By using 0 and relative values in the appropriate fields, you can create a series of partitions without calculating any absolute values in advance. For example, if you are on a blank hard drive, the following sgdisk command sequence creates all the basic partitions required for a typical Linux installation:
# sgdisk-n 0:0:+1MiB-t 0:ef02-c 0:grub / dev/sda# sgdisk-n 0:0:+1GiB-t 0:ea00-c 0:boot / dev/sda# sgdisk-n 0:0:+4GiB-t 00:ef02 8200-c 0:swap / dev/sda# sgdisk-n 0:0:0-t 0purl 8300-c 0:root / dev/sda
The above example shows how to partition a hard disk for a BIOS-based computer. Grub partitions are not required on UEFI-based computers. Because sgdisk calculated all the absolute values for you in the above example, you can skip * commands on UEFI-based computers and run the rest without modification. Similarly, you can skip creating a swap partition and do not need to modify the remaining commands.
There is also a shortcut to delete all partitions on the hard drive with one command:
# sgdisk-- zap-all / dev/sda
For more information about * * and more, please refer to the man page:
The above $man sgdisk is all the contents of the article "how to use sgdisk to manage partitions in linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.