sgdisk 磁盘操作命令

划分磁盘分区

sgdisk -n 1:+2G:+50G /dev/sda

划分磁盘分区,一号分区划分为50G,同时预留2G的空间

磁盘格式化

sgdisk -z -og /dev/sda

查看分区详情

sgdisk -i 1 /dev/hda查看hda第一分区的详情信息

[root@node3 ~]# sgdisk -i 1 /dev/sdb
Partition GUID code: 4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D (Unknown)
Partition unique GUID: 3A913191-07B4-4629-A2BD-E5016547BFF8
First sector: 4194304 (at 2.0 GiB)
Last sector: 4399137 (at 2.1 GiB)
Partition size: 204834 sectors (100.0 MiB)
Attribute flags: 0000000000000000
Partition name: 'ceph data osd.178'
查看磁盘分区数量

sgdisk -p /dev/hdb

[root@node2 ~]# sgdisk -p /dev/hdb
Disk /dev/hdb: 468862128 sectors, 223.6 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 2B4A5E9E-A941-4B21-AE3D-0506FE8F6DFC
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 468862094
Partitions will be aligned on 2048-sector boundaries
Total free space is 5399491 sectors (2.6 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1         4194304       375390241   177.0 GiB   FFFF  ceph data osd.0
   2       375392256       417333281   20.0 GiB    FFFF  
   3       417335296       421527585   2.0 GiB     FFFF  
   4       421529600       463470625   20.0 GiB    FFFF  
   5       463472640       467664929   2.0 GiB     FFFF 
修改分区的type code(partition guid code)

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

修改分区名

sgdisk -c 1:"ceph data" /dev/hda修改hda第一分区的分区名为"ceph data"

清除分区数据

sgdisk -z /dev/hda1

删除分区

sgdisk -d 1 /dev/hda删除第一分区

你可能感兴趣的:(#,linux操作系统:文件系统,linux,操作系统技能树)