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 the Root Partition online by LVM in CentOS 5

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

Share

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

This article mainly shows you how to expand the root partition online in LVM in CentOS 5. The content is simple and easy to understand. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn about how to expand the root partition online in LVM in CentOS 5.

Description:

Linux kernel above 2.6 supports ext3 online expansion

Case 1: Add a new hard disk directly

# df -h Look at the hard drive now

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

6.7G 5.2G 1.3G 81% /

/dev/sda1 99M 12M 82M 13% /boot

tmpfs 633M 0 633M 0% /dev/shm

# fdisk -l can see newly added hard disk/dev/sdb

Disk /dev/sda: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 104391 83 Linux

/dev/sda2 14 1044 8281507+ 8e Linux LVM

Disk /dev/sdb: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

# lvm

lvm>vgdisplay You can first see if there is any space left in the volume group that can be expanded. If there is any space left, you can directly expand it. If there is no space left, or if there is not enough space, you can add a new hard disk.

--- Volume group ---

VG Name VolGroup00

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 3

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 2

Open LV 2

Max PV 0

Cur PV 1

Act PV 1

VG Size 7.88 GB

PE Size 32.00 MB

Total PE 252

Alloc PE / Size 252 / 7.88 GB

Free PE / Size 0 / 0

VG UUID 0U8dPB-UTJZ-Mdv5-eZJM-Xj7f-gR1M-63BcCh

lvm>pvcreate /dev/sdb Create an lvm physical volume using the new entire hard disk

lvm>vgextend /dev/VolGroup00 /dev/sdb Add a new physical volume to a volume group

lvm>vgdisplay You can see allocated and unallocated space All PE / Size and Free PE / Size

--- Volume group ---

VG Name VolGroup00

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 15.84 GB

PE Size 32.00 MB

Total PE 507

Alloc PE / Size 252 / 7.88 GB

Free PE / Size 255 / 7.97 GB

VG UUID 0U8dPB-UTJZ-Mdv5-eZJM-Xj7f-gR1M-63BcCh

lvm>lvextend -L +7.9G /dev/VolGroup00/LogVol00 Extend logical volume size

lvm>vgdisplay

lvm>pvdisplay

lvm>lvdisplay You can see that it has been added

--- Logical volume ---

LV Name /dev/VolGroup00/LogVol00

VG Name VolGroup00

LV UUID QtNkTM-TeSo-WnZD-fSUr-6k1F-5aLX-zAIfSQ

LV Write Access read/write

LV Status available

# open 1

LV Size 14.78 GB

Current LE 473

Segments 2

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 253:0

--- Logical volume ---

LV Name /dev/VolGroup00/LogVol01

VG Name VolGroup00

LV UUID bhTEBX-t8XK-zGku-NCzx-eolz-Anvj-jUMUER

LV Write Access read/write

LV Status available

# open 1

LV Size 1.00 GB

Current LE 32

Segments 1

Allocation inherit

Read ahead sectors auto

- currently set to 256

Block device 253:1

lvm>quit

# resize2fs -p /dev/VolGroup00/LogVol00 Modify file system size for extended space

# df -h

Case 2: Add only one new partition

# df -h can see newly added hard disk/dev/sdb1

# lvm

lvm>pvcreate /dev/sdb1 Create an lvm physical volume using the new hard disk

lvm>vgextend /dev/VolGroup00 /dev/sdb1

lvm>vgdisplay You can see allocated and unallocated space All PE / Size and Free PE / Size

lvm>lvextend -L +5G /dev/VolGroup00/LogVol00

lvm>vgdisplay

lvm>pvdisplay

lvm>lvdisplay

lvm>quit

# resize2fs -p /dev/VolGroup00/LogVol00 extension

# df -h

The above is "CentOS 5 LVM online how to expand the root partition" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to 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