centos lvm 扩容

vvilog@centos /h/vvilog> /sbin/vgdisplay

--- Volume group ---

VG Name               centos

System ID

Format                lvm2

Metadata Areas        1

Metadata Sequence No  4

VG Access             read/write

VG Status             resizable

MAX LV                0

Cur LV                3

Open LV               3

Max PV                0

Cur PV                1

Act PV                1

VG Size               <110.81 GiB

PE Size               4.00 MiB

Total PE              28367

Alloc PE / Size       28367 / <110.81 GiB

Free  PE / Size       0 / 0

VG UUID               Nt91Zx-Haal-LOPL-fDJF-XGjk-SvaA-yl9hgL

vvilog@centos /h/vvilog> /sbin/vgdisplay

--- Volume group ---

VG Name               centos

System ID

Format                lvm2

Metadata Areas        1

Metadata Sequence No  4

VG Access             read/write

VG Status             resizable

MAX LV                0

Cur LV                3

Open LV               3

Max PV                0

Cur PV                1

Act PV                1

VG Size               <110.81 GiB

PE Size               4.00 MiB

Total PE              28367

Alloc PE / Size       28367 / <110.81 GiB

Free  PE / Size       0 / 0

VG UUID               Nt91Zx-Haal-LOPL-fDJF-XGjk-SvaA-yl9hgL

vvilog@centos /h/vvilog> /sbin/lvdisplay

--- Logical volume ---

LV Path                /dev/centos/root

LV Name                root

VG Name                centos

LV UUID                NUekJb-ZCIc-mwcL-ExzX-ROYd-bD7T-HmPqql

LV Write Access        read/write

LV Creation host, time centos, 2018-07-11 19:47:08 +0800

LV Status              available

# open                 1

LV Size                60.00 GiB

Current LE             15360

Segments               1

Allocation             inherit

Read ahead sectors     auto

- currently set to     256

Block device           253:0

--- Logical volume ---

LV Path  /dev/centos/home

LV Name                home

VG Name                centos

LV UUID                eShHQo-MewK-xN7H-ZqBu-GIV6-KMQI-YA606U

LV Write Access        read/write

LV Creation host, time centos, 2018-07-11 19:47:09 +0800

LV Status              available

# open                 1

LV Size                48.00 GiB

Current LE             12288

Segments               1

Allocation             inherit

Read ahead sectors     auto

- currently set to     256

Block device           253:2

--- Logical volume ---

LV Path /dev/centos/swap

LV Name                swap

VG Name                centos

LV UUID                hwO7J7-gmbh-jgiT-vFLA-jsdI-8241-CSHEM8

LV Write Access        read/write

LV Creation host, time centos, 2018-07-11 19:47:10 +0800

LV Status              available

# open                 2

LV Size                <2.81 GiB

Current LE             719

Segments               1

Allocation             inherit

Read ahead sectors     auto

- currently set to     256

Block device           253:1

vvilog@centos /h/vvilog>/sbin/fdisk /dev/sda

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): t

Partition number (1-4, default 4): 4

Partition type (type L to list all types): 8e

Type of partition 4 is unchanged: Linux filesystem

Command (m for help): w

The 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.

vvilog@centos /h/vvilog> /sbin/partprobe

vvilog@centos /h/vvilog> /sbin/fdisk /dev/sda

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): p

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: gpt

Disk identifier: 30B84C4D-0A79-4BAE-8950-8C0FDF86949E

#         Start          End    Size  Type            Name

1         2048      1026047    500M  EFI System      EFI System Partition

2      1026048      2050047    500M  Microsoft basic

3      2050048    234440703  110.8G  Linux LVM

4    234440704   1953523711  819.7G  Linux filesyste

Command (m for help): t

Partition number (1-4, default 4): 4

Partition type (type L to list all types): l

   19 Linux swap                     0657FD6D-A4AB-43C4-84E5-0933C84B4F4F

 31 Linux LVM                      E6D6D379-F507-44C2-A23C-238F2A3DF928

Partition type (type L to list all types): t

Type of partition 4 is unchanged: Linux filesystem

Command (m for help): t

Partition number (1-4, default 4): 4

Partition type (type L to list all types): 31

Changed type of partition 'Linux filesystem' to 'Linux LVM'

Command (m for help): w

The 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.

vvilog@centos /h/vvilog> /sbin/partprobe

vvilog@centos /h/vvilog> /usr/sbin/vgextend centos /dev/sda4

Volume group "centos" successfully extended

vvilog@centos /h/vvilog> whereis  lvextend

lvextend: /usr/sbin/lvextend /usr/share/man/man8/lvextend.8.gz

vvilog@centos /h/vvilog> /sbin/lvextend -L +760g /dev/centos/home

Size of logical volume centos/home changed from 48.00 GiB (12288 extents) to 808.00 GiB (206848 extents).

Logical volume centos/home successfully resized.

vvilog@centos /h/vvilog> df -lh

Filesystem               Size  Used Avail Use% Mounted on

/dev/mapper/centos-root   60G  5.5G   55G  10% /

devtmpfs                 1.7G     0  1.7G   0% /dev

tmpfs                    1.7G     0  1.7G   0% /dev/shm

tmpfs                    1.7G  9.6M  1.7G   1% /run

tmpfs                    1.7G     0  1.7G   0% /sys/fs/cgroup

/dev/sda2                497M  178M  320M  36% /boot

/dev/sda1                500M  9.8M  490M   2% /boot/efi

/dev/mapper/centos-home   48G  5.6G   43G  12% /home

tmpfs                    344M   12K  344M   1% /run/user/1000

vvilog@centos /h/vvilog> /sbin/resize2fs /dev/centos/home

resize2fs 1.42.9 (28-Dec-2013)

/sbin/resize2fs: Bad magic number in super-block while trying to open /dev/centos/home

Couldn't find valid filesystem superblock.

vvilog@centos /h/vvilog>/sbin/xfs_growfs /dev/centos/home

meta-data=/dev/mapper/centos-home isize=512    agcount=4, agsize=3145728 blks

=                       sectsz=512   attr=2, projid32bit=1

=                       crc=1        finobt=0 spinodes=0

data     =                       bsize=4096   blocks=12582912, imaxpct=25

=                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0 ftype=1

log      =internal               bsize=4096   blocks=6144, version=2

=                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

data blocks changed from 12582912 to 211812352

vvilog@centos /h/vvilog> df -lh

Filesystem               Size  Used Avail Use% Mounted on

/dev/mapper/centos-root   60G  5.5G   55G  10% /

devtmpfs                 1.7G     0  1.7G   0% /dev

tmpfs                    1.7G     0  1.7G   0% /dev/shm

tmpfs                    1.7G  9.6M  1.7G   1% /run

tmpfs                    1.7G     0  1.7G   0% /sys/fs/cgroup

/dev/sda2                497M  178M  320M  36% /boot

/dev/sda1                500M  9.8M  490M   2% /boot/efi

/dev/mapper/centos-home  808G  5.6G  803G   1% /home

tmpfs                    344M   12K  344M   1% /run/user/1000

推荐阅读更多精彩内容