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

Partition expansion of centos7 / redhat 7

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Linux capacity expansion: change the system id of the partition to lvm (8e) with fdisk before the partition capacity expansion

Create a logical volume:

Create PV (convert physical volumes)-- > create VG--- > create LV and format

Fdisk / dev/sdb, create partition and change id to 8e

Fdisk / dev/sdc create partition and change id to 8e

Fdisk / dev/sdd create partition and change id to 8e

Pvscan to see if physical volumes are currently available

Pvdisplay

1. [root@localhost ~] # pvcreate / dev/sdb1

Physical volume "/ dev/sdb1" successfully created.

[root@localhost ~] # pvcreate / dev/sdc1

Physical volume "/ dev/sdc1" successfully created.

[root@localhost ~] # pvcreate / dev/sdc1

Physical volume "/ dev/sdc1" successfully created.

[root@localhost ~] #

2. Create a volume group VG

Vgscan 、 vgdisplay

[root@localhost ~] # vgscan

Reading volume groups from cache.

[root@localhost ~] # vgcreate mail_store / dev/sdc1 / dev/sdb1 / dev/sdd1

Volume group "mail_store" successfully created

[root@localhost ~] #

3. Create LV

[root@localhost ~] # lvscan

[root@localhost ~] # lvdisplay

[root@localhost ~] #

[root@localhost ~] # lvcreate-L 15G (size)-n mail (name) mail_store (volume group)

Logical volume "mail" created.

[root@localhost ~] # lvscan

ACTIVE'/ dev/mail_store/mail' [15.00 GiB] inherit

[root@localhost ~] # lvdisplay

-Logical volume

LV Path / dev/mail_store/mail

LV Name mail

VG Name mail_store

LV UUID j5Hvhi-ppem-Okz1-CV0o-SnKY-Gkdk-lr2zXU

LV Write Access read/write

LV Creation host, time localhost.localdomain, 2019-12-01 03:11:40 + 0800

LV Status available

Open 0

LV Size 15.00 GiB

Current LE 3840

Segments 2

Allocation inherit

Read ahead sectors auto

Currently set to 8192

Block device 253:0

Format lv to ext4 file type: mkfs-t ext4 / dev/mail_store/mail

[root@localhost] # mkfs-t ext4 / dev/mail_store/mail

Mke2fs 1.42.9 (28-Dec-2013)

File system label =

OS type: Linux

Block size = 4096 (log=2)

Chunk size = 4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

983040 inodes, 3932160 blocks

196608 blocks (5.00%) reserved for the super user

First data block = 0

Maximum filesystem blocks=2151677952

120 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: done

Writing inode table: complete

Creating journal (32768 blocks): complete

Writing superblocks and filesystem accounting information: done

Mount lv to the / mnt directory: mount / dev/mail_store/mail / mnt/

[root@localhost ~] # mount / dev/mail_store/mail / mnt/

[root@localhost ~] # df-Th

File system type capacity used available used mount point

/ dev/sda2 ext4 17G 3.5G 13G 22% /

Devtmpfs devtmpfs 897M 0 897m 0% / dev

Tmpfs tmpfs 912M 0912m 0% / dev/shm

Tmpfs tmpfs 912m 9.1m 903m 1% / run

Tmpfs tmpfs 912M 0912m 0% / sys/fs/cgroup

/ dev/sda1 xfs 1014M 175M 840M 18% / boot

Tmpfs tmpfs 183M 20K 183M 1% / run/user/1000

/ dev/sr0 iso9660 3.8G 3.8G 0100% / run/media/mcq/RHEL-7.4 Server.x86_64

Tmpfs tmpfs 183M 0 183M 0% / run/user/0

/ dev/mapper/mail_store-mail ext4 15G 41m 14G 1% / mnt

[root@localhost ~] #

Summarize the steps:

A, pvcreate / dev/sdc1 create a new pv partition

Note: a possible error may be reported. You need to update the partition table, execute partprobe, and then execute

Partprobe

[root@localhost ~] # pvcreate / dev/sdb2

Physical volume "/ dev/sdb2" successfully created.

B. Vgextand ROOT / dev/sdc1 expands the new pv partition to vg group ROOT

[root@localhost ~] # vgextend VAR / dev/sdb2

Volume group "VAR" successfully extended

C, lvextend / dev/VAR/var / dev/sdb2 or lvextend-L + 20g / dev/VAR/var put the newly expanded space into the lv volume

[root@localhost ~] # lvextend / dev/VAR/var / dev/sdb2

Size of logical volume VAR/var changed from 2.00 GiB (512 extents) to

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