LVM是逻辑盘卷管理(Logical Volume Manager)的简称,它是Linux环境下对磁盘分区进行管理的一种机制,LVM是建立在硬盘和分区之上的一个逻辑层,从而提高磁盘分区管理的灵活性。接下来通过实验来详细了解LVM的使用。Linux入门教程:使用LVM逻辑卷管理器管理灵活存储 http://www.linuxidc.com/Linux/2014-07/104443.htmCentOS 6.3下配置LVM(逻辑卷管理) http://www.linuxidc.com/Linux/2014-06/103839.htmLinux LVM简明教程 http://www.linuxidc.com/Linux/2014-06/103390.htmLinux的LVM(Logical Volume Manager) 学习笔记 http://www.linuxidc.com/Linux/2014-05/101880.htmRHCE认证笔记:LVM实验 http://www.linuxidc.com/Linux/2014-04/99685.htmLinux系统管理之LVM案例 http://www.linuxidc.com/Linux/2014-02/96987.htm1.实验环境准备.添加一块未使用过的磁盘/dev/sdb,使用fdisk从其中分出两个5G的分区,并且将其分区类型该为8e[root@localhost ~]# fdisk -l /dev/sdbDisk /dev/sdb: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0f199ec4 Device Boot Start End Blocks Id System/dev/sdb1 1 654 5253223+ 8e Linux LVM/dev/sdb2 655 1308 5253255 8e Linux LVM
2.创建物理卷:[root@localhost ~]# pvcreate /dev/sdb1 Physical volume "/dev/sdb1" successfully created[root@localhost ~]# pvcreate /dev/sdb2 dev_is_mpath: failed to get device for 8:18 Physical volume "/dev/sdb2" successfully created[root@localhost ~]# pvscan PV /dev/sda2 VG vg0 lvm2 [59.99 GiB / 7.99 GiB free] PV /dev/sdb1 lvm2 [5.01 GiB] PV /dev/sdb2 lvm2 [5.01 GiB] Total: 3 [70.01 GiB] / in use: 1 [59.99 GiB] / in no VG: 2 [10.02 GiB]
3.在物理卷的基础上创建卷组,将/dev/sdb1加入卷组[root@localhost ~]# vgcreate test /dev/sdb1 Volume group "test" successfully create[root@localhost ~]# vgscan #可以看到卷组test已经创建成功 Reading all physical volumes. This may take a while... Found volume group "test" using metadata type lvm2 Found volume group "vg0" using metadata type lvm2
4.在卷组test中创建一个大小为4G的逻辑卷test1[root@localhost ~]# lvcreate -L 4G -n test1 test Logical volume "test1" created[root@localhost ~]# lvscan ACTIVE "/dev/test/test1" [4.00 GiB] inherit #test1已经创建成功 ACTIVE "/dev/vg0/root" [20.00 GiB] inherit ACTIVE "/dev/vg0/swap" [2.00 GiB] inherit ACTIVE "/dev/vg0/usr" [10.00 GiB] inherit ACTIVE "/dev/vg0/var" [20.00 GiB] inherit
5.接下来就可以按照普通分区,对test1进行格式化,并且挂载使用了[root@localhost ~]# mkfs.ext4 /dev/test/test1mke2fs 1.41.12 (17-May-2010)......This filesystem will be automatically checked every 34 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override.[root@localhost ~]# mkdir /test[root@localhost ~]# mount /dev/test/test1 /test/[root@localhost ~]# df -hFilesystem Size Used Avail Use% Mounted on/dev/mapper/vg0-root 20G 428M 19G 3% /tmpfs 246M 0 246M 0% /dev/shm/dev/sda1 194M 30M 155M 16% /boot/dev/mapper/vg0-usr 9.9G 2.3G 7.2G 24% /usr/dev/mapper/vg0-var 20G 361M 19G 2% /var/dev/mapper/test-test1 4.0G 136M 3.7G 4% /test #逻辑卷成功创建
6.在/test下放入一个文件,测试可否使用[root@localhost test]# echo "lv test" >a.txt[root@localhost test]# cat a.txtlv test
更多详情见请继续阅读下一页的精彩内容: http://www.linuxidc.com/Linux/2014-08/105381p2.htm
Ubuntu下GoAgent访问Youtube,Google相关站点SSL错误解决Linux程序安装之RPM相关资讯 LVM
- 基于LVM的快照实现原理分析 (今 10:23)
- LVM逻辑卷创建管理 (07月19日)
- LVM基本概念、管理 (01月27日)
| - 创建LVM的日志记录 (09月23日)
- 在Oracle Linux 5.11上构建基于LVM (02月14日)
- Linux LVM空间扩容演示 (10/09/2015 16:04:53)
|
本文评论 查看全部评论 (0)