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 create LVM and format centos7 disk repartition

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

Share

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

This article introduces centos7 disk re-partition how to create LVM and format, the content is very detailed, interested friends can refer to, hope to be helpful to you.

1. Disk partition, two divided into two regions, one 160g and one 40G

[root@mysql innodb_log] # fdisk / dev/vdb

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/vdb: 322.1 GB, 322122547200 bytes, 629145600 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x8510d8fb

Device Boot Start End Blocks Id System

/ dev/vdb1 2048 209717247 104857600 83 Linux

Command (m for help): n

Partition type:

P primary (1 primary, 0 extended, 3 free)

E extended

Select (default p): P

Partition number (2-4, default 2):

First sector (209717248-629145599, default 209717248):

Using default value 209717248

Last sector, + sectors or + size {KMagne Mpeng} (209717248-629145599, default 629145599): + 160G

Partition 2 of type Linux and of size 160 GiB is set

Command (m for help): n

Partition type:

P primary (2 primary, 0 extended, 2 free)

E extended

Select (default p): P

Partition number (3pr 4, default 3):

First sector (545261568-629145599, default 545261568):

Using default value 545261568

Last sector, + sectors or + size {KMagne Mpeng} (545261568-629145599, default 629145599):

Using default value 629145599

Partition 3 of type Linux and of size 40 GiB is set

Command (m for help): P

Disk / dev/vdb: 322.1 GB, 322122547200 bytes, 629145600 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x8510d8fb

Device Boot Start End Blocks Id System

/ dev/vdb1 2048 209717247 104857600 83 Linux

/ dev/vdb2 209717248 545261567 167772160 83 Linux

/ dev/vdb3 545261568 629145599 41942016 83 Linux

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.

2. Set the format to LVM

[root@mysql innodb_log] # fdisk-l

Disk / dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x000be2dd

Device Boot Start End Blocks Id System

/ dev/vda1 * 2048 1050623 524288 83 Linux

/ dev/vda2 1050624 20971519 9960448 8e Linux LVM

/ dev/vda3 20971520 83886079 31457280 5 Extended

/ dev/vda5 20973568 83886079 31456256 8e Linux LVM

Disk / dev/mapper/vg01-lv01: 42.4 GB, 42404413440 bytes, 82821120 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk / dev/vdb: 322.1 GB, 322122547200 bytes, 629145600 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x8510d8fb

Device Boot Start End Blocks Id System

/ dev/vdb1 2048 209717247 104857600 83 Linux

/ dev/vdb2 209717248 545261567 167772160 83 Linux

/ dev/vdb3 545261568 629145599 41942016 83 Linux

[root@mysql innodb_log] # fdisk / dev/vdb

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-3, default 3): 2

Hex code (type L to list all codes): 8e

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

Command (m for help): t

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

Hex code (type L to list all codes): 8e

Changed type of partition 'Linux' 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.

[root@mysql innodb_log] # partprobe

Warning: Unable to open / dev/sr0 read-write (Read-only file system). / dev/sr0 has been opened read-only.

[root@mysql innodb_log] # fdisk-l

Disk / dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x000be2dd

Device Boot Start End Blocks Id System

/ dev/vda1 * 2048 1050623 524288 83 Linux

/ dev/vda2 1050624 20971519 9960448 8e Linux LVM

/ dev/vda3 20971520 83886079 31457280 5 Extended

/ dev/vda5 20973568 83886079 31456256 8e Linux LVM

Disk / dev/mapper/vg01-lv01: 42.4 GB, 42404413440 bytes, 82821120 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk / dev/vdb: 322.1 GB, 322122547200 bytes, 629145600 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x8510d8fb

Device Boot Start End Blocks Id System

/ dev/vdb1 2048 209717247 104857600 83 Linux

/ dev/vdb2 209717248 545261567 167772160 8e Linux LVM

/ dev/vdb3 545261568 629145599 41942016 8e Linux LVM

3. Create LVM

Two pv: / dev/vdb2 / dev/vdb3

A correspondence of vg: / dev/vdb2 / dev/vdb3

One lv: 160g

[root@mysql innodb_log] # pvs

PV VG Fmt Attr PSize PFree

/ dev/vda2 vg01 lvm2 a muri-

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