sgdisk基本用法

2021-08-04 12:35:39 字數 4014 閱讀 7199

sgdisk是linux下操作gpt分割槽的工具,就像fdisk是操作mbr分割槽的工具。關於gpt和mbr的區別請參考:

root@ceph1:~$ sgdisk --help | grep new

-n, --new=partnum:start:end

create

new partition

root@ceph1

:~# sgdisk -n 0:0:0 /dev/vdd

creating new gpt entries.

the operation has completed successfully.

root@ceph1

:~# lsblk | grep vdd

name

maj:min

rmsize

rotype

mountpoint

vdd 253:48

040g 0 disk

└─vdd1 253:49

020g 0 part

root@ceph1

:~# sgdisk -n 2:0:+5g /dev/vdd

creating new gpt entries.

the operation has completed successfully.

root@ceph1

:~# lsblk | grep vdd

name

maj:min

rmsize

rotype

mountpoint

vdd 253:48

040g 0 disk

└─vdd1 253:49

020g 0 part

└─vdd2 253:50

05g 0 part

root@ceph1

:~$ sgdisk --help | grep info

-i, --info=partnum show detailed information on partition

-i 顯示某個分割槽詳情

root@ceph1:~# sgdisk -i 1 /dev/vdd

partition guid code: 0fc63daf-8483-4772-8e79-3d69d8477de4 (linux filesystem)

partition unique guid: c7eb237f-9a8f-4938-b010-125b3d6d0d4a

first sector: 2048 (at 1024.0 kib)

last sector: 41943006 (at 20.0 gib)

partition size: 41940959 sectors (20.0 gib)

attribute flags: 0000000000000000

partition name: ''

root@ceph1

:~$ sgdisk --help | grep typecode

-t, --typecode=partnum: change partition type code

-t 修改某個分割槽的type code

root@ceph1

:~# sgdisk -t 1:4fbd7e29-9d25-41b8-afd0-062c0ceff05d /dev/vdd

the operation has completed successfully.

root@ceph1

:~# sgdisk -i 1 /dev/vdd

partition

guid

code:

4fbd7e29-9d25-41b8-afd0-062c0ceff05d (unknown)

partition unique guid

:c7eb237f-9a8f-4938-b010-125b3d6d0d4a

first

sector:

2048 (at 1024.0

kib)

last

sector:

41943006 (at 20.0

gib)

partition

size:

41940959 sectors (20.0

gib)

attribute

flags:

0000000000000000

partition

name:

''

root@ceph1

:~$ sgdisk --help | grep change-name

-c, --change-name=partnum:name change partition's name

-c 修改某個分割槽的分割槽名

root@ceph1:~# sgdisk  -c 1:"ceph data" /dev/vdd

the operation has completed successfully.

root@ceph1:~# sgdisk -i 1 /dev/vdd

partition guid code: 4fbd7e29-9d25-41b8-afd0-062c0ceff05d (unknown)

partition unique guid: c7eb237f-9a8f-4938-b010-125b3d6d0d4a

first sector: 2048 (at 1024.0 kib)

last sector: 41943006 (at 20.0 gib)

partition size: 41940959 sectors (20.0 gib)

attribute flags: 0000000000000000

partition name: 'ceph data'

root@ceph1

:~$ sgdisk --help | grep zap

-z, --zap zap (destroy) gpt (but not

mbr) data structures

root@ceph1:~# sgdisk -z /dev/vdd1

creating new gpt entries.

warning: the kernel is still using

the old partition table.

the new table will be used at

the next reboot.

gpt data structures destroyed! you may now partition the disk using fdisk or

other utilities.

root@ceph1:~$ sgdisk --help | grep delete

-d, --delete=partnum delete a partition

-d 刪除乙個分割槽

root@ceph1

:~# sgdisk -d 1 /dev/vdd

the operation has completed successfully.

root@ceph1

:~# lsblk | grep vdd

name

maj:min

rmsize

rotype

mountpoint

vdd 253:48

040g 0 disk

└─vdd2 253:50

05g 0 part

python基本用法 Python基本用法總結

python 的設計具有很強的可讀性,易於使用。這裡對python基本用法做乙個總結介紹。一 變數型別 1 變數賦值 python中的變數賦值不需要型別宣告,每個變數在使用前都必須賦值,變數賦值之後才會被建立。使用等號進行變數的賦值。2 多個變數賦值 為多個變數賦值時或進行列表內資料的交換時,可以使...

mysql 的基本用法 mysql基本用法

mysql 5.1 中文參考手冊 show databases 顯示資料庫 drop database 資料庫名 刪除資料庫 set names utf8 設定資料庫編碼為utf 8 source x 資料庫名.sql 匯入乙個資料庫 use 資料庫名 嘗試訪問資料庫 create database...

mysql 的基本用法 mysql基本用法

mysql 5.1 中文參考手冊 show databases 顯示資料庫 drop database 資料庫名 刪除資料庫 set names utf8 設定資料庫編碼為utf 8 source x 資料庫名.sql 匯入乙個資料庫 use 資料庫名 嘗試訪問資料庫 create database...