LVM逻辑卷创建管理
首先添加三块磁盘分别为5G、6G、7G
重启开机
查看硬盘状态
# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000cb05d
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 25004031 12296192 8e Linux LVM
Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdc: 6442 MB, 6442450944 bytes, 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdd: 7516 MB, 7516192768 bytes, 14680064 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/rhel-root: 10.5 GB, 10485760000 bytes, 20480000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/rhel-swap: 2097 MB, 2097152000 bytes, 4096000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
可看出sda为原先硬盘,新建的为sdb sdc sdd
给sdb分驱
# fdisk /dev/sdb
Command (m for help): p
Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x83a82975
Device Boot Start End Blocks Id System
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-10485759, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-10485759, default 10485759): +2G
Partition 1 of type Linux and of size 2 GiB is set
Command (m for help): P
Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x83a82975
Device Boot Start End Blocks Id System
/dev/sdb1 2048 4196351 2097152 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 (4196352-10485759, default 4196352):
Using default value 4196352
Last sector, +sectors or +size{K,M,G} (4196352-10485759, default 10485759): +1G
Partition 2 of type Linux and of size 1 GiB is set
Command (m for help):w
保存退出,如查命令:
Command (m for help): help
h: unknown command
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
将2分区转成pv
# pvcreate /dev/sdb1 /dev/sdb2
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdb2" successfully created
创建大小为100的逻辑卷
# lvcreate -n lv01 -l 100 vf01
Volume group "vf01" not foun
将/dev/vf01/lv01格式化为ext4格式
# mkfs -t ext4 /dev/vf01/lv01
# mount /dev/vf01/lv01 /mnt/lv01/
# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/rhel-root xfs 9.8G 1.4G 8.5G 14% /
devtmpfs devtmpfs 908M 0 908M 0% /dev
tmpfs tmpfs 914M 0 914M 0% /dev/shm
tmpfs tmpfs 914M 8.6M 905M 1% /run
tmpfs tmpfs 914M 0 914M 0% /sys/fs/cgroup
/dev/sda1 xfs 197M 81M 116M 42% /boot
/dev/mapper/vf01-lv01 ext4 380M 2.3M 354M 1% /mnt/lv01
发现已经有了
/dev/mapper/vf01-lv01 ext4 380M 2.3M 354M 1% /mnt/lv01
-----------------------------------------------------------------------------------------------------------------