centos扩容lv_centos 调整分区大小和lv的扩容

[root@node-1 ~]# fdisk /dev/vda

Welcome to fdisk (util-linux 2.23.2).

Changes will remainin memory only, until you decide to writethem.

Be careful before using thewritecommand.

Command (mforhelp): p

Disk/dev/vda: 42.9 GB, 42949672960 bytes, 83886080sectors

Units= sectors of 1 * 512 = 512bytes

Sector size (logical/physical): 512 bytes / 512bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk label type: dos

Disk identifier:0x000d4405Device Boot Start End Blocks Id System/dev/vda1 * 2048 2099199 1048576 83Linux/dev/vda2 2099200 20971519 94361608e Linux LVM

Command (mforhelp): d

Partition number (1,2, default 2): 2Partition2is deleted

Command (mforhelp): n

Partition type:

p primary (1 primary, 0 extended, 3 free)

e extended

Select (default p): p

Partition number (2-4, default 2):

First sector (2099200-83886079, default 2099200):

Using default value2099200Last sector,+sectors or +size{K,M,G} (2099200-83886079, default 83886079):

Using default value83886079Partition2 of type Linux and of size 39GiB is set

Command (mforhelp): p

Disk/dev/vda: 42.9 GB, 42949672960 bytes, 83886080sectors

Units= sectors of 1 * 512 = 512bytes

Sector size (logical/physical): 512 bytes / 512bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk label type: dos

Disk identifier:0x000d4405Device Boot Start End Blocks Id System/dev/vda1 * 2048 2099199 1048576 83Linux/dev/vda2 2099200 83886079 40893440 83Linux

Command (mforhelp): t

Partition number (1,2, default 2): 2Hex code (type L to list all codes): 8e

Changed type of partition'Linux' to 'Linux LVM'Command (mforhelp): p

Disk/dev/vda: 42.9 GB, 42949672960 bytes, 83886080sectors

Units= sectors of 1 * 512 = 512bytes

Sector size (logical/physical): 512 bytes / 512bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk label type: dos

Disk identifier:0x000d4405Device Boot Start End Blocks Id System/dev/vda1 * 2048 2099199 1048576 83Linux/dev/vda2 2099200 83886079 408934408e Linux LVM

Command (mfor help): wThe partition table has been altered!Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.######重启虚拟机后,再操作

[root@node-1 ~]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

vda252:0 0 40G 0disk

├─vda1252:1 0 1G 0 part /boot

└─vda2252:2 0 39G 0part

├─centos-root 253:0 0 8G 0 lvm /└─centos-swap 253:1 0 1G 0lvm [SWAP]

[root@node-1 ~]# pvs

PV VG Fmt Attr PSize PFree/dev/vda2 centos lvm2 a-- <9.00g 0[root@node-1 ~]# pvresize /dev/vda2

Physical volume"/dev/vda2"changed1 physical volume(s) resized / 0physical volume(s) not resized

[root@node-1 ~]# pvs

PV VG Fmt Attr PSize PFree/dev/vda2 centos lvm2 a-- <39.00g 30.00g

[root@node-1 ~]# lvextend -l +100%FREE /dev/mapper/centos-root

Size of logical volume centos/root changed from <8.00 GiB (2047 extents) to <38.00 GiB (9727extents).

Logical volume centos/root successfully resized.

[root@node-1 ~]# lvs

LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert

root centos-wi-ao---- <38.00g

swap centos-wi-ao---- 1.00g

[root@node-1 ~]# xfs_growfs /dev/mapper/centos-root

meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=524032blks= sectsz=512 attr=2, projid32bit=1

= crc=1 finobt=0 spinodes=0data= bsize=4096 blocks=2096128, imaxpct=25

= sunit=0 swidth=0blks

naming=version 2 bsize=4096 ascii-ci=0 ftype=1log=internal bsize=4096 blocks=2560, version=2

= sectsz=512 sunit=0 blks, lazy-count=1realtime=none extsz=4096 blocks=0, rtextents=0data blocks changed from2096128 to 9960448[root@node-1 ~]# df -h

Filesystem Size Used Avail Use%Mounted on/dev/mapper/centos-root 38G 1.1G 37G 3% /devtmpfs1.9G 0 1.9G 0% /dev

tmpfs1.9G 0 1.9G 0% /dev/shm

tmpfs1.9G 17M 1.9G 1% /run

tmpfs1.9G 0 1.9G 0% /sys/fs/cgroup/dev/vda1 1014M 143M 872M 15% /boot

tmpfs 380M0 380M 0% /run/user/0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值