题目为:使用sdb这块5GB的硬盘创建四个1GB的分区,并使用这四个分区创建一个名称为test_vg的卷组,
最后从该卷组中创建出两个大小为1.2GB的逻辑卷,名称分别为test_web、test_data。
系统
[root@nfs ~]# uname -a
Linux nfs.kwx.com 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
使用到的命令是parted,具体的命令解释如下:
[root@nfs ~]# parted --help
Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]
Apply COMMANDs with PARAMETERS to DEVICE. If no COMMAND(s) are given, run in
interactive mode.
选项:
-h, --help 显示此求助信息
-l, --list lists partition layout on all block devices
-m, --machine displays machine parseable output
-s, --script 从不提示用户
-v, --version 显示版本
-a, --align=[none|cyl|min|opt] alignment for new partitions
命令:
align-check TYPE N check partition N for TYPE(min|opt)
alignment
help [COMMAND] print general help, or help on
COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition
table)
mkpart PART-TYPE [FS-TYPE] START END make a partition
name NUMBER NAME name partition NUMBER as NAME
print [devices|free|list,all|NUMBER] display the partition table,
available devices, free space, all found partitions, or a particular
partition
quit exit program
rescue START END rescue a lost partition near START
and END
resizepart NUMBER END resize partition NUMBER
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
disk_set FLAG STATE change the FLAG on selected device
disk_toggle [FLAG] toggle the state of FLAG on selected
device
set NUMBER FLAG STATE change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]] toggle the state of FLAG on partition
NUMBER
unit UNIT set the default unit to UNIT
version display the version number and
copyright information of GNU Parted
Report bugs to bug-parted@gnu.org
[root@nfs ~]#
可以输入parted直接进入dos模式,也可以带参数直接使用parted命令,这里我选择的是带参数,各位看看就好。。。
1.首先分区:
第一步将sdb转换为gpt模式,其实这一步对于本次练习来说没多大用。。
[root@nfs ~]# parted /dev/sdb mklabel gpt
警告: 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
信息: You may need to update /etc/fstab.
[root@nfs ~]#
第二步新建四个分区:
[root@nfs ~]# parted /dev/sdb mkpart primary 0 1G
警告: The resulting partition is not properly alig