Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use the sgdisk command of linux to manipulate GPT partitions

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Today Xiaobian to share with you is the use of linux sgdisk command operation GPT partition, I believe many people do not know, in order to let everyone know more, so give you a summary of the following content, look down together. I'm sure you'll find something.

sgdisk is a tool for manipulating GPT partitions under Linux, and the sgdisk program uses a completely command-line based user interface that makes it suitable for scripts or experts who want to make one or two quick changes to the disk.

Syntax format: sgdisk [parameter] [device]

Common parameters:

-p Print partition table-d x Delete partition-n x:y:z Create a new partition with number x, starting with sector y and ending with sector z-c x:y Change the name of partition x to y-t x:y-t x:y Change the type of partition x to y-list-types List partition type codes

Reference Example

Print partition table:

[root@linuxcool ~]# sgdisk -p /dev/sda

Delete the first partition of sda:

[root@linuxcool ~]# sgdisk -d 1 /dev/sda

Create a new partition numbered 1, starting with 1MiB and ending with 2MiB:

[root@linuxcool ~]# sgdisk -n 1:1MiB:2MiB /dev/sda

Change the name of the partition numbered 1 to grub:

[root@linuxcool ~]# sgdisk -c 1:grub /dev/sda

Change partition number 1 to ef02:

[root@linuxcool ~]# sgdisk -t 1:ef02 /dev/sda

List partition type codes:

[root@linuxcool ~]# sgdisk --list-types About the use of linux sgdisk command operation GPT partition shared here, I hope the above content can have a certain reference value for everyone, you can learn to apply. If you like this post, share it with more people.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report