Linux逻辑卷管理(LVM)

前言:LVM基本术语物理存储介质(The physical media)这里指系统的存储设备:硬盘,如:/dev/hda、/dev/sda等等,是存储系统最低层的存储单元。物理卷(physical volume)物理卷就是指硬盘分区或从逻辑上与磁盘分区具有同样功能的设备(如RAID),是LVM的基本存储逻辑块,但和基本的物理存储介质(如分区、磁盘等)比较,却包含有与LVM相关的管理参数。卷组(Volume Group)LVM卷组类似于非LVM系统中的物理硬盘,其由物理卷组成。可以在卷组上创建一个或多个“LVM分区”(逻辑卷),LVM卷组由一个或多个物理卷组成。逻辑卷(logical volume)LVM的逻辑卷类似于非LVM系统中的硬盘分区,,在逻辑卷之上可以建立文件系统(比如/home或者/usr等)。PE(physical extent)每一个物理卷被划分为称为PE(Physical Extents)的基本单元,具有唯一编号的PE是可以被LVM寻址的最小单元。PE的大小是可配置的,默认为4MB。LE(logical extent)逻辑卷也被划分为被称为LE(Logical Extents) 的可被寻址的基本单位。在同一个卷组中,LE的大小和PE是相同的,并且一一对应。一、创建逻辑卷的步骤1)通过pvcreate命令将linux分区处理成物理卷(PV);2)通过vgcreate命令将创建好的物理卷处理成卷组(Vg);3)通过lvcreate命令将卷组分成若干个逻辑卷(Lv);之后我们可以对逻辑卷进行格式化,挂载,删除等操作,我们可以动态的调整逻辑卷的大小,并且该操作不会影响我们在逻辑卷(Lv)上的数据。二、物理卷创建管理操作1、物理分区信息[root@node1 ~]# fdisk /dev/sddThe number of cylinders for this disk is set to 2610.There is nothing wrong with that, but this is larger than 1024,and could in certain setups cause problems with:1) software that runs at boot time (e.g., old versions of LILO)2) booting and partitioning software from other OSs(e.g., DOS FDISK, OS/2 FDISK)Command (m for help): pDisk /dev/sdd: 21.4 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/sdd1 1 200 1606468+ 83 Linux/dev/sdd2 201 400 1606500 83 Linux/dev/sdd3 401 600 1606500 83 Linux/dev/sdd4 601 2610 16145325 5 Extended/dev/sdd5 601 800 1606468+ 83 Linux/dev/sdd6 801 1000 1606468+ 83 Linux/dev/sdd7 1001 1200 1606468+ 83 Linux/dev/sdd8 1201 1400 1606468+ 83 Linux/dev/sdd9 1600 1800 1614532+ 83 Linux/dev/sdd10 1401 1599 1598404+ 83 Linux/dev/sdd11 1801 2000 1606468+ 83 Linux/dev/sdd12 2001 2200 1606468+ 83 Linux/dev/sdd13 2201 2400 1606468+ 83 Linux/dev/sdd14 2401 2610 1686793+ 83 LinuxPartition table entries are not in disk order2、创建物理卷[root@node1 ~]# pvcreate /dev/sdd*Device /dev/sdd not found (or ignored by filtering).Physical volume “/dev/sdd1″ successfully createdPhysical volume “/dev/sdd10″ successfully createdPhysical volume “/dev/sdd11″ successfully createdPhysical volume “/dev/sdd12″ successfully createdPhysical volume “/dev/sdd13″ successfully createdPhysical volume “/dev/sdd14″ successfully createdPhysical volume “/dev/sdd2″ successfully createdPhysical volume “/dev/sdd3″ successfully createdDevice /dev/sdd4 not found (or ignored by filtering).Physical volume “/dev/sdd5″ successfully createdPhysical volume “/dev/sdd6″ successfully createdPhysical volume “/dev/sdd7″ successfully createdPhysical volume “/dev/sdd8″ successfully createdPhysical volume “/dev/sdd9″ successfully created3、删除物理卷[root@node1 ~]# pvremove /dev/sdd1Labels on physical volume “/dev/sdd1″ successfully wiped4、添加物理卷[root@node1 ~]# pvcreate /dev/sdd1Physical volume “/dev/sdd1″ successfully created5、查看物理卷信息[root@node1 ~]# pvscanPV /dev/sdd1 lvm2 [1.53 GB]PV /dev/sdd2 lvm2 [1.53 GB]PV /dev/sdd3 lvm2 [1.53 GB]PV /dev/sdd5 lvm2 [1.53 GB]PV /dev/sdd6 lvm2 [1.53 GB]PV /dev/sdd7 lvm2 [1.53 GB]PV /dev/sdd8 lvm2 [1.53 GB]PV /dev/sdd9 lvm2 [1.54 GB]PV /dev/sdd10 lvm2 [1.52 GB]PV /dev/sdd11 lvm2 [1.53 GB]PV /dev/sdd12 lvm2 [1.53 GB]PV /dev/sdd13 lvm2 [1.53 GB]PV /dev/sdd14 lvm2 [1.61 GB]Total: 13 [19.99 GB] / in use: 0 [0 ] / in no VG: 13 [19.99 GB]6、查看物理卷详细参数root@node1 ~]# pvdisplay /dev/sdd5“/dev/sdd5″ is a new physical volume of “1.53 GB”— NEW Physical volume —PV Name /dev/sdd5VG NamePV Size 1.53 GBAllocatable NOPE Size (KByte) 0Total PE 0Free PE 0Allocated PE 0PV UUID 7Ms1jT-wxUI-2d7l-h24c-t17F-J9vL-fz2zHM

想念我的时候,不要忘记我也在想念你。

Linux逻辑卷管理(LVM)

相关文章:

你感兴趣的文章:

标签云: