linux创建硬盘分区lvm,Linux创建LVM磁盘分区

一、创建LVM格式分区

ACES01:~ # ls /dev/sdb

/dev/sdb

ACES01:~ # fdisk /dev/sdb

Welcome to fdisk (util-linux 2.28).

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

Be careful before using the write command.

Device does not contain a recognized partition table.

Created a new DOS disklabel with disk identifier 0xedea1b84.

Command (m for help): n

Partition type

p primary (0 primary, 0 extended, 4 free)

e extended (container for logical partitions)

Select (default p): p

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

First sector (2048-33554431, default 2048):

Last sector, +sectors or +size{K,M,G,T,P} (2048-33554431, default 33554431): 33554431

Created a new partition 1 of type 'Linux' and of size 16 GiB.

Command (m for help): t

Selected partition 1

Partition type (type L to list all types): 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.

Syncing disks.

二、创建LVM卷

ACES01:~ # ls /dev/sdb1

/dev/sdb1

ACES01:~ # pvcreate /dev/sdb1

Physical volume "/dev/sdb1" successfully created

ACES01:~ # pvs

PV VG Fmt Attr PSize PFree

/dev/sda1 system lvm2 a-- 100.00g 38.00g

/dev/sdb1 lvm2 --- 16.00g 16.00g

ACES01:~ # vgcreate vgshare01 /dev/sdb1

Volume group "vgshare01" successfully created

ACES01:~ # vgs

VG #PV #LV #SN Attr VSize VFree

system 1 2 0 wz--n- 100.00g 38.00g

vgshare01 1 0 0 wz--n- 16.00g 16.00g

ACES01:~ # lvcreate -n lvshare01 -l 100%FREE vgshare01

Logical volume "lvshare01" created.

ACES01:~ # lvs

LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert

root system -wi-ao---- 60.00g

swap system -wi-ao---- 2.00g

lvshare01 vgshare01 -wi-a----- 16.00g

三、格式化并挂载lv卷

ACES01:~ # mkfs.ext4 /dev/vgshare01/lvshare01

mke2fs 1.42.11 (09-Jul-2014)

Creating filesystem with 4193280 4k blocks and 1048576 inodes

Filesystem UUID: a823269d-656d-4e66-9c4e-4eac54c7b488

Superblock backups stored on blocks:

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

4096000

Allocating group tables: done

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

ACES01:~ # mkdir /share

ACES01:~ # mount /dev/vgshare01/lvshare01 /share/

ACES01:~ # cd /share/

ACES01:/share # ls

lost+found

2019-1-28 12:44:22

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值