新增存储用Parted分区并建LVM卷
新增存储用Parted分区并建LVM卷
一,Parted分区
1,parted分区 www.ahlinux.com
# parted /dev/sda
GNU Parted 2.1
使用 /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) help 首先看看帮助熟悉下
align-check TYPE N check partition N for TYPE(min|opt) alignment
check NUMBER do a simple check on the file system
cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition
help [COMMAND] print general help, or help on COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition table)
mkfs NUMBER FS-TYPE make a FS-TYPE file system on partition NUMBER
mkpart PART-TYPE [FS-TYPE] START END make a partition
mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system
move NUMBER START END move partition NUMBER
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
resize NUMBER START END resize partition NUMBER and its file system
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
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
(parted) mktable
新的磁盘标签类型? gpt GPT就是GRUB分区表,如果是MBR,最大支持2T分区
(parted) p 打印一下信息这里的4398GB是磁盘容量
Model: DELL MD32xx (scsi)
Disk /dev/sda: 4398GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name 标志
(parted) mkpart #新建分区
分区名称? []? #默认
文件系统类型? [ext2]? #默认
起始点? 0G #起点
结束点? 4398G #终点
(parted) p
Model: DELL MD32xx (scsi)
Disk /dev/sda: 4398GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name 标志
1 1049kB 4398GB 4398GB
(parted) toggle 1 lvm #标记成lvm
(parted) p
Model: DELL MD32xx (scsi)
Disk /dev/sda: 4398GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name 标志
1 1049kB 4398GB 4398GB lvm
(parted) quit
信息: You may need to update /etc/fstab.
2,同样的方法对sdb,sdc,sdd 分区
二,创建LVM,分三大步,分别建PV,VG,LVM
1,建PV
# pvcreate /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
Writing physical volume data to disk "/dev/sda1"
Physical volume "/dev/sda1" successfully created
Writing physical volume data to disk "/dev/sdb1"
Physical volume "/dev/sdb1" successfully created
Writing physical volume data to disk "/dev/sdc1"
Physical volume "/dev/sdc1" successfully created
Writing physical volume data to disk "/dev/sdd1"
Physical volume "/dev/sdd1" successfully created
2,建VG
# vgcreate md3200 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
Volume group "md3200" successfully created
# lvcreate -n md3200lv1 -L 8T md3200
Logical volume "md3200lv1" created
You have new mail in /var/spool/mail/root
3,建L
- 本文来自:Linux学习网