4.分区方法

[root@rhel7 ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): n ##新建
Partition type:
p primary (0 primary, 0 extended, 4 free) ##主分区
e extended ##扩展分区
Select (default p): p ##建立主分区
Partition number (1-4, default 1): 1 ##分区表位置
First sector (2048-20971519, default 2048): ##分区起始位置(推荐使用默认)
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +100M ##分区结束位置
Partition 1 of type Linux and of size 100 MiB is set

Command (m for help): p ##显示分区表

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0002db10

Device Boot Start End Blocks Id System
/dev/sdb1 2048 206847 102400 83 Linux

Command (m for help): wq ##退出保存,如果直接q表示退出不保存
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@rhel7 ~]# partprobe ##同步分区表
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
[root@rhel7 ~]# mkfs.xfs /dev/sdb1 ##格式化设备为xfs文件系统(相当与在/dev/sdb1上安装设备管理软件)
mkfs.xfs: /dev/sdb1 appears to contain an existing filesystem (xfs).
mkfs.xfs: Use the -f option to force overwrite.

三.MBR分区方式转换成GPT

 

[root@rhel7 ~]# parted /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type ‘help’ to view a list of commands.

(parted) mklabel

New disk label type? gpt
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?

Yes/No? yes

(parted) quit
Information: You may need to update /etc/fstab.

 

 

四.GPT分区方式

[root@rhel7 ~]# fdisk /dev/sdb
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): n ##新建
Partition number (1-128, default 1): 1 ##分区表位置
First sector (34-20971486, default 2048): ##分区起始位置(推荐使用默认)
Last sector, +sectors or +size{K,M,G,T,P} (2048-20971486, default 20971486): +100M ##分区结束位置
Created partition 1

Command (m for help): p ##显示分区

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt ##分区方式为gpt
Disk identifier: 76E1957A-23A1-4FCB-8880-0DBAA9B5823A

# Start End Size Type Name
1 2048 206847 100M Linux filesyste

Command (m for help): wq ##退出保存
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

 

五.GPT分区方式转换成MBR

 

 

[root@rhel7 ~]# parted /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type ‘help’ to view a list of commands.

(parted) mklabel

New disk label type? msdos
Warning: The existing disk label on /dev/sdb will be destroyed and all
data on this disk will be lost. Do you want to continue?

Yes/No? yes

(parted) quit
Information: You may need to update /etc/fstab.

 

转自:

https://blog.csdn.net/chaos_oper/article/details/104559861

 

原文地址:http://www.cnblogs.com/shttke/p/16831655.html

1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长! 2. 分享目的仅供大家学习和交流,请务用于商业用途! 3. 如果你也有好源码或者教程,可以到用户中心发布,分享有积分奖励和额外收入! 4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解! 5. 如有链接无法下载、失效或广告,请联系管理员处理! 6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需! 7. 如遇到加密压缩包,默认解压密码为"gltf",如遇到无法解压的请联系管理员! 8. 因为资源和程序源码均为可复制品,所以不支持任何理由的退款兑现,请斟酌后支付下载 声明:如果标题没有注明"已测试"或者"测试可用"等字样的资源源码均未经过站长测试.特别注意没有标注的源码不保证任何可用性