与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.

sgdisk常用操作的更多相关文章

  1. 【三】用Markdown写blog的常用操作

    本系列有五篇:分别是 [一]Ubuntu14.04+Jekyll+Github Pages搭建静态博客:主要是安装方面 [二]jekyll 的使用 :主要是jekyll的配置 [三]Markdown+ ...

  2. php模拟数据库常用操作效果

    test.php <?php header("Content-type:text/html;charset='utf8'"); error_reporting(E_ALL); ...

  3. Mac OS X常用操作入门指南

    前两天入手一个Macbook air,在装软件过程中摸索了一些基本操作,现就常用操作进行总结, 1关于触控板: 按下(不区分左右)            =鼠标左键 control+按下        ...

  4. mysql常用操作语句

    mysql常用操作语句 1.mysql -u root -p   2.mysql -h localhost -u root -p database_name 2.列出数据库: 1.show datab ...

  5. nodejs配置及cmd常用操作

    一.cmd常用操作 1.返回根目录cd\ 2.返回上层目录cd .. 3.查找当前目录下的所有文件dir 4.查找下层目录cd window 二.nodejs配置 Node.js安装包及源码下载地址为 ...

  6. Oracle常用操作——创建表空间、临时表空间、创建表分区、创建索引、锁表处理

    摘要:Oracle数据库的库表常用操作:创建与添加表空间.临时表空间.创建表分区.创建索引.锁表处理 1.表空间 ■  详细查看表空间使用状况,包括总大小,使用空间,使用率,剩余空间 --详细查看表空 ...

  7. python 异常处理、文件常用操作

    异常处理 http://www.jb51.net/article/95033.htm 文件常用操作 http://www.jb51.net/article/92946.htm

  8. byte数据的常用操作函数[转发]

    /// <summary> /// 本类提供了对byte数据的常用操作函数 /// </summary> public class ByteUtil { ','A','B',' ...

  9. Linux Shell数组常用操作详解

    Linux Shell数组常用操作详解 1数组定义: declare -a 数组名 数组名=(元素1 元素2 元素3 ) declare -a array array=( ) 数组用小括号括起,数组元 ...

随机推荐

  1. Mysql:Forcing close of thread xxx user: 'root' 的解决方法

    MySQL server在中午的时候忽然挂掉.重启mysql也尽是失败,只有重启电脑才能解决,然而重装了MySQL也是不行,晚上还是挂, 去看mysql的errorlog,只能看到类似如下的信息: F ...

  2. curl模拟登录新浪微博

     这几天要做个获取新浪微博@我的信息, 又不用第三方登录,所以只能通过模拟登录来获取信息,研究的一下发现直接模拟登录微博比较困难,验证的算法比较复杂,于是绕道通过登录新浪通行证后来获取cookie 来 ...

  3. [刘阳Java]_MyBatis_动态SQL标签用法_第7讲

    1.MyBatis的动态SQL是基于OGNL表达式的,它可以帮助我们方便的在SQL语句中实现某些逻辑. 2.MyBatis中用于实现动态SQL的元素主要有 if choose(when,otherwi ...

  4. C# 动软生成器对应的Access数据库操作类DbHelperOleDb

    using System;using System.Collections;using System.Collections.Specialized;using System.Data;using S ...

  5. JAVA学习笔记(一):一个小爬虫的例子

    1.import java.io.*;   java.io.*不是一个文件,而是一组类.它是在java.io包里的所有类,*是通配符,比如a*.txt代表的就是以a开头的所有txt文件,“?”是单个词 ...

  6. spring缓存

    Spring Cache使用详解   复制过来时的地址:http://blog.csdn.net/xiaoyu411502/article/details/48901555 标签: spring-bo ...

  7. 利用Maple推导向量方程的微分公式

    在某些几何软件的开发中,会要求写出一个向量方程的微分公式.对我而言,手工推导繁琐.易出错.且需要反复校验. 早就听说Mathematica, Maple这样的软件可以自动进行符号公式的推导,一直没有时 ...

  8. WKwebView与JS交互(h5主动)

    先:WKUIDelegate,WKNavigationDelegate,WKScriptMessageHandler // 创建一个webiview的配置项 WKWebViewConfiguratio ...

  9. Centos版Linux 一些常用操作命令

    Linux命令收集 1.文件处理命令:ls 功能描述:显示目录文件 命令英文原意:list 命令所在路径:/bin/ls 执行权限:所有用户 语法:  ls  选项[-ald]  [文件或目录] -a ...

  10. 优化openfire服务器,达到单机20万,集群50万

    openfire压测概述 个月左右的测试,总算得到预定目标(3台服务器,并发50w用户在线) 测试环境搭建 压测客户端无他-tsung,尝试了windows安装perl失败后,使用centOS6.5作 ...