zoukankan      html  css  js  c++  java
  • sgdisk常用操作

    与fdisk创建MBR分区一样,sgdisk是一个创建GPT分区的工具,如果你还不了解GPT分区,请参考The difference between booting MBR and GPT with GRUB

    查看所有GPT分区

    # sgdisk -p /dev/sdb
    Disk /dev/sdb: 16780288 sectors, 8.0 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 4D5B29E8-6E0B-45DA-8E52-A21910E74479
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 16780254
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 4061 sectors (2.0 MiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1        10487808        16780254   3.0 GiB     FFFF  ceph data
       2            2048        10485760   5.0 GiB     FFFF  ceph journal
    

    查看某个分区的详细的信息

    #/usr/sbin/sgdisk --info=1 /dev/sdb
    Partition GUID code: 89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE (Unknown)
    Partition unique GUID: C8D04950-18E6-4102-A867-B874CF94EA74
    First sector: 10487808 (at 5.0 GiB)
    Last sector: 16780254 (at 8.0 GiB)
    Partition size: 6292447 sectors (3.0 GiB)
    Attribute flags: 0000000000000000
    Partition name: 'ceph data'
    

    删除所有分区

    # sgdisk --zap-all --clear --mbrtogpt /dev/sdb
    GPT data structures destroyed! You may now partition the disk using fdisk or
    other utilities.
    The operation has completed successfully.
    

    创建分区

    创建分区2,扇区从2048到10485760,type code为8300。

    # sgdisk -n 2:2048:10485760 -t 2:8300 -p /dev/sdb
    Disk /dev/sdb: 16780288 sectors, 8.0 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 5888A491-1245-4B40-8AEA-A6AEB2C302BB
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 16780254
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 6296508 sectors (3.0 GiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       2            2048        10485760   5.0 GiB     8300  
    Warning: The kernel is still using the old partition table.
    The new table will be used at the next reboot.
    The operation has completed successfully.
    
    # sgdisk -n 1:2048 -t 1:8300 -p /dev/sdb
    Disk /dev/sdb: 7813837232 sectors, 3.6 TiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 361860D7-33F5-45E6-9A86-406FE19B1C36
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 7813837198
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 4294969310 sectors (2.0 TiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1            2048      3518869902   1.6 TiB     8300  
    The operation has completed successfully.
    

    删除指定的分区

    删除分区2。

    # sgdisk --delete=2 /dev/sdb
    Warning: The kernel is still using the old partition table.
    The new table will be used at the next reboot.
    The operation has completed successfully.
  • 相关阅读:
    sql server 中 bit 字段的 查询方法
    C# 4.0新特性"协变"与"逆变"以及背后的编程思想
    marginleft是做边距,是宽度 left是定位盒子左上角左边位置的一个点
    什么是企业库 怎么使用企业库 企业库的好处 企业库的目标
    SQL各种Join用法(Full,Left,Out,Inner)
    JavaScript计算两个文本框内数据的乘积(四舍五入保留两位小数)
    SQL VIEW(视图)
    Sql ISNULL() 函数
    left join 和 left outer join 有什么区别
    18个不常见的C#关键字,您使用过几个?
  • 原文地址:https://www.cnblogs.com/gaohong/p/4971523.html
Copyright © 2011-2022 走看看