1, 파티션을 생성
[루트 @ 호스트 10-158-172-44 ~] # FDISK는 / dev / VDA
FDISK (폴더의 유틸리티 - 리눅스 2.23.2)에 오신 것을 환영합니다.
당신이 그들을 쓰기로 결정 때까지 변화는 메모리에만 유지됩니다.
쓰기 명령을 사용하기 전에주의해야합니다.
명령 (도움 m) : N
파티션 유형 :
P의 차 (2 차, 0 연장, 2 자유)
전자 확장
(기본 p)를 선택 입력
파티션 번호 (3,4, 기본 3) : 입력
첫 번째 섹터 (41943040-83886079, 기본 41943040) : 입력
기본값은 41943040을 사용하여
마지막 부문, + 분야 또는 + 크기 {K, M, G} (41943040-83886079, 기본 83886079) :
기본값은 83886079을 사용하여
20 지브 형 리눅스와 크기의 파티션 (3) 설정
명령 (도움 m) : t
파티션 번호 (1-3, 기본 3) : 입력
16 진 코드 (모든 코드를 나열하는 타입 L) : 8E
파티션의 변경된 유형 '리눅스 LVM'에서 '리눅스'
명령 (도움 m) : w
파티션 테이블이 변경되었습니다!
IOCTL ()를 호출하는 파티션 테이블을 다시 읽어보십시오.
경고 : 장치 또는 리소스 바쁜 : 파티션 테이블 오류 16 실패했습니다 다시 읽기.
커널은 여전히 이전 테이블을 사용합니다. 새로운 테이블에 사용됩니다
다음에 다시 부팅하거나 partprobe (8) 또는합니다 kpartx를 실행 한 후 (8)
디스크를 동기화.
[루트 @ 호스트 - 10-158-172-44 ~] # fdisk를 -l
디스크는 / dev / VDA : 42.9 GB, 42,949,672,960 바이트 83886080 개 부문
1 * 512 = 512 바이트의 섹터 단위 =
섹터 크기 (논리 / 물리적) : 512 바이트 / 512 바이트
I / O의 크기 (최소 / 최적) : 512 바이트 / 512 바이트
디스크 라벨 종류 : 도스
디스크 식별자 : 0x0009b56e
장치 부팅 시작 끝 블록 ID 시스템
/dev/vda1 * 2048 1026047 512000 83 Linux
/dev/vda2 1026048 41943039 20458496 8e Linux LVM
/dev/vda3 41943040 83886079 20971520 8e Linux LVM
Disk /dev/mapper/centos-root: 18.8 GB, 18756927488 bytes, 36634624 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 /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 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
2,创建PV
[root@host-10-158-172-44 ~]# partprobe #使分区表生效,无需重启
[root@host-10-158-172-44 ~]# pvcreate /dev/vda3 #使用pvcreate转换
WARNING: dos signature detected on /dev/vda3 at offset 510. Wipe it? [y/n]: y
Wiping dos signature on /dev/vda3.
Physical volume "/dev/vda3" successfully created
[root@host-10-158-172-44 ~]# pvdisplay #查看已经存在的pv
--- Physical volume ---
PV Name /dev/vda2
VG Name centos
PV Size 19.51 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 4994
Free PE 10
Allocated PE 4984
PV UUID 2MR7wz-fh1t-6nlO-glse-MEBz-8Rjo-Y7gkhI
"/dev/vda3" is a new physical volume of "20.00 GiB"
--- NEW Physical volume ---
PV Name /dev/vda3
VG Name
PV Size 20.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID dvb6J8-YszL-KP8x-LDHc-RGwT-pB3u-s19Pe9
3,扩展VG
[root@host-10-158-172-44 ~]# vgextend centos /dev/vda3
Volume group "centos" successfully extended
[root@host-10-158-172-44 ~]# vgdisplay #查看已经存在的vg
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 39.50 GiB
PE Size 4.00 MiB
Total PE 10113
Alloc PE / Size 4984 / 19.47 GiB
Free PE / Size 5129 / 20.04 GiB
VG UUID h5CW2E-aYjt-AZLN-CTMe-7lZp-e2xk-yuDnLs
4,扩展LV
[root@host-10-158-172-44 ~]# lvdisplay #查看已经存在的lv
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID U0ANhF-afAc-pb0U-AYmN-EJH0-Wyj8-H2bvws
LV Write Access read/write
LV Creation host, time localhost, 2015-12-01 21:35:58 +0800
LV Status available
# open 2
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID sG5AuB-SsYW-ggN5-tl6l-csEg-14F7-6NNVnO
LV Write Access read/write
LV Creation host, time localhost, 2015-12-01 21:35:59 +0800
LV Status available
# open 1
LV Size 17.47 GiB
Current LE 4472
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
[root@host-10-158-172-44 ~]# lvextend -L 37G /dev/centos/root #扩展lv
Size of logical volume centos/root changed from 20.00 GiB (5120 extents) to 37.00 GiB (9472 extents).
Logical volume root successfully resized
注:lvextend -r -l +100%FREE /dev/centos/root #可使用此命令将所有的vg全部分配
5,执行重设大小
[root@host-10-158-172-44 ~]# xfs_growfs /dev/mapper/centos-root #重设大小
meta-data=/dev/mapper/centos-root isize=256 agcount=5, agsize=1144832 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=5242880, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 5242880 to 9699328
[root@host-10-158-172-44 ~]# df -h #查看
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 37G 789M 37G 3% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 8.4M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/vda1 497M 120M 378M 25% /boot