1.首先使用fdisk对新磁盘分区并格式化
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-2097151999, default 63):
Using default value 63
Last sector or +size or +sizeM or +sizeK (63-2097151999, default 2097151999):
Using default value 2097151999
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
2.使用parted将分区转为PV
Number Start End Size Type File system Flags
1 32.3kB 1074GB 1074GB primary
(parted) toggle 1 LVM
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 1074GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 1074GB 1074GB primary lvm
3.将PV加入VG
[root@mio-100 ~]# vgextend lv_1 /dev/sdc1
/dev/cdrom: open failed: Read-only file system
No physical volume label read from /dev/sdc1
Physical volume "/dev/sdc1" successfully created
Volume group "lv_1" successfully extended
4.查看VG状态
root@mio-100 ~]# vgdisplay
--- Volume group ---
VG Name lv_1
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 3
Act PV 3
VG Size 1.01 TB
PE Size 32.00 MB
Total PE 33199
Alloc PE / Size 604 / 18.88 GB
Free PE / Size 32595 / 1018.59 GB
VG UUID qEFNCV-JQFW-K41E-m7XY-Rfo1-4yBM-rMO3rO
5.向LV添加空间
[root@mio-100 ~]# lvextend -L +500G /dev/lv_1/Lv_main
/dev/cdrom: open failed: Read-only file system
Extending logical volume Lv_main to 518.88 GB
Logical volume Lv_main successfully resized
6.扩展文件系统 resize2fs
[root@mio-100 ~]# resize2fs -f /dev/mapper/lv_1-Lv_main
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/lv_1-Lv_main is mounted on /; on-line resizing required
Performing an on-line resize of /dev/mapper/lv_1-Lv_main to 136019968 (4k) blocks.
The filesystem on /dev/mapper/lv_1-Lv_main is now 136019968 blocks long.
[root@mio-100 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/lv_1-Lv_main
503G 1.8G 475G 1% /
上一篇:开启GZIP压缩 下一篇:快递查询API