Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to expand LVM capacity in linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about how to expand LVM in linux. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

1. Check the current disk status of this machine.

[root@oralce10g ~] # df

Filesystem 1K-blocks Used Available Use% Mounted on

/ dev/mapper/vg_oralce10g-LogVol03 9591312 4765404 4338692 53%

Tmpfs 883132 72 883060 / dev/shm

/ dev/sda1 198337 29991 158106 16% / boot

/ dev/mapper/vg_oralce10g-LogVol01 4031680 73636 3753244 2% / tmp

/ dev/mapper/vg_oralce10g-LogVol02 15118728 14334340 16388 100% / U01

[root@oralce10g ~] # fdisk-l

Disk / dev/sda: 32.2 GB, 32212254720 bytes

255 heads, 63 sectors/track, 3916 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: 0x00085d3a

Device Boot Start End Blocks Id System

/ dev/sda1 * 1 26 204800 83 Linux

Partition 1 does not end on cylinder boundary.

/ dev/sda2 26 3917 31251456 8e Linux LVM

Disk / dev/sdb: 21.5GB, 21474836480 bytes # # find doesn't contain a valid partition table

255 heads, 63 sectors/track, 2610 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_oralce10g-LogVol00: 2097 MB, 2097152000 bytes

255 heads, 63 sectors/track, 254 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_oralce10g-LogVol03: 9978 MB, 9978249216 bytes

255 heads, 63 sectors/track, 1213 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_oralce10g-LogVol01: 4194 MB, 4194304000 bytes

255 heads, 63 sectors/track, 509 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_oralce10g-LogVol02: 15.7 GB, 15728640000 bytes

255 heads, 63 sectors/track, 1912 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

2. Create a physical volume

[root@oralce10g ~] # pvcreate / dev/sdb

Physical volume "/ dev/sdb" successfully created

3. "pvdisplay" command to view physical volumes

[root@oralce10g ~] # pvdisplay

-Physical volume

PV Name / dev/sda2

VG Name vg_oralce10g

PV Size 29.80 GiB / not usable 3.00 MiB

Allocatable yes (but full)

PE Size 4.00 MiB

Total PE 7629

Free PE 0

Allocated PE 7629

PV UUID lRqQzT-LRSi-xUS0-wO54-OBw1-pVan-kCKWIb

"/ dev/sdb" is a new physical volume of "20.00 GiB" # newly created physical volume

-NEW Physical volume

PV Name / dev/sdb

VG Name

PV Size 20.00 GiB

Allocatable NO

PE Size 0

Total PE 0

Free PE 0

Allocated PE 0

PV UUID 5nHvN3-xTgI-uYNO-245u-arM0-1M8H-CeR1Tp

4. Add the newly added physical volume to the existing logical volume group

[root@oralce10g ~] # vgextend vg_oralce10g / dev/sdb

Volume group "vg_oralce10g" successfully extended

5. View the space of the volume group

[root@oralce10g ~] # vgdisplay

-Volume group

VG Name vg_oralce10g # # VG name

System ID

Format lvm2

Metadata Areas 2

Metadata Sequence No 6

VG Access read/write # # VG access

VG Status resizable

MAX LV 0

Cur LV 4

Open LV 4

Max PV 0

Cur PV 2

Act PV 2

VG Size 49.80 GiB

PE Size 4.00 MiB

Total PE 12748 # # Total number of PE

Alloc PE / Size 7629 / 29.80 GiB # # assigned PE

Free PE / Size 5119 / 20.00 GiB # number and size of Free PE

VG UUID uSfeH7-09v9-dMRE-E6ex-IQlB-C4QM-3clpUm

6. Expand the capacity of existing volumes (if 29.9G is the remaining available capacity, you can

< -L +29.9G >

, expand the capacity in the original space)

[root@oralce10g] # lvextend-L 34G-n / dev/mapper/vg_oralce10g-LogVol02 / dev/sdb

Extending logical volume LogVol02 to 34.00 GiB

Logical volume LogVol02 successfully resized

7. After the volume expansion is configured above, execute the following command to reassign the disk:

[root@oralce10g ~] # resize2fs / dev/mapper/vg_oralce10g-LogVol02

Resize2fs 1.41.12 (17-May-2010)

Filesystem at / dev/mapper/vg_oralce10g-LogVol02 is mounted on / u01; on-line resizing required

Old desc_blocks = 2, new_desc_blocks = 3

Performing an on-line resize of / dev/mapper/vg_oralce10g-LogVol02 to 8912896 (4k) blocks.

The filesystem on / dev/mapper/vg_oralce10g-LogVol02 is now 8912896 blocks long.

[root@oralce10g] # df-h

Filesystem Size Used Avail Use% Mounted on

/ dev/mapper/vg_oralce10g-LogVol03 9.2G 4.6G 4.2G 53% /

Tmpfs 863M 72K 863m 1% / dev/shm

/ dev/sda1 194m 30m 155m 16% / boot

/ dev/mapper/vg_oralce10g-LogVol01 3.9G 72m 3.6G 2% / tmp

/ dev/mapper/vg_oralce10g-LogVol02 34G 14G 19G 44% / U01 > lvm has been expanded

The above is how to expand LVM in the linux shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report