Get the App
SLTechnology News&Howtos  ›  Servers  › 

Expanding the size of Linux logical volumes with LVM

Shulou Source: shulou.com Published: 2022-06-02 06:43:04 10月04日 Update

[root@TEST ~] # df-hl

[root@TEST ~] # fdisk-l

Disk / dev/sda: 53.7 GB, 53687091200 bytes

64 heads, 32 sectors/track, 51200 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

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

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

Disk identifier: 0x000af440

Device Boot Start End Blocks Id System

/ dev/sda1 * 2 501 512000 83 Linux

Partition 1 does not end on cylinder boundary.

/ dev/sda2 502 51200 51915776 8e Linux LVM

Partition 2 does not end on cylinder boundary.

Disk / dev/sdb: 17.2 GB, 17179869184 bytes

64 heads, 32 sectors/track, 16384 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

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

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

Disk identifier: 0x00000000

Disk / dev/sdc: 42.9 GB, 42949672960 bytes

64 heads, 32 sectors/track, 40960 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

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

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

Disk identifier: 0x00000000

Disk / dev/mapper/vg_redhat-lv_root: 49.0 GB, 48997859328 bytes

255 heads, 63 sectors/track, 5956 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

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

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

Disk identifier: 0x00000000

Disk / dev/mapper/vg_redhat-lv_swap: 4160 MB, 4160749568 bytes

255 heads, 63 sectors/track, 505 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

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

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

Disk identifier: 0x00000000

[root@TEST ~] # fdisk / dev/sdc

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0x93ae6d58.

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

After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w (rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

Switch off the mode (command 'c') and change display units to

Sectors (command'u').

Command (m for help): n

Command action

E extended

P primary partition (1-4)

P

Partition number (1-4): 1

First cylinder (1-40960, default 1):

Using default value 1

Last cylinder, + cylinders or + size {KMagne Mpeng} (1-40960, default 40960): + 40G

Value out of range.

Last cylinder, + cylinders or + size {KMagne Mpeng} (1-40960, default 40960): + 39G

Command (m for help): t

Selected partition 1

Hex code (type L to list codes): l

0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris

1 FAT12 39 Plan 9 82 Linux swap / So C1 DRDOS/sec (FAT-

2 XENIX root 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-

3 XENIX usr 40 Venix 80286 84 OS/2 hidden C: C6 DRDOS/sec (FAT-

4 FAT16

Tags: Size name command manual thus space logic Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Docker OPPO Reno vpn Huawei