lvm命令总结
作者 佚名技术
来源 Linux系统
浏览
发布时间 2012-04-30
#fdisk /dev/hda Command (m for help): p Disk /dev/hda: 255 heads, 63 sectors, 623 cylinders Units = cylinders of 16065 * 512 bytes Device Boot Start End Blocks Id System /dev/hda1 1 2 16033 83 Linux /dev/hda2 3 600 4803435 83 Linux /dev/hda3 601 607 56227 83 Linux /dev/hda4 608 614 56227 83 Linux Command (m for help): t Partition number (1-4): 3 Hex code (type L to list codes): 8e Command (m for help): p Disk /dev/hda: 255 heads, 63 sectors, 623 cylinders Units = cylinders of 16065 * 512 bytes Device Boot Start End Blocks Id System /dev/hda1 1 2 16033 83 Linux /dev/hda2 3 600 4803435 83 Linux /dev/hda3 601 607 56227 8e Unknown /dev/hda4 608 614 56227 83 Linux Command (m for help): w 我们对/dev/hdb2做同样的操作,这是需要的,以至LVM能重建你应该丢失的配置. 通常,不需要重启,但有些计算机却要求.因此如果下面的例子不工作,试试重启. 接着我们创建物理卷(PV),如下: # pvcreate /dev/hda3 pvcreate -- physical volume "/dev/hda3" successfully created # pvcreate /dev/hdb2 pvcreate -- physical volume "/dev/hdb2" successfully created 我们再将这两个物理卷(PV)加到一个叫做“test”的卷组(VG)中: # vgcreate test /dev/hdb2 /dev/hda3 拥有帝国一切,皆有可能。欢迎访问phome.net vgcreate -- INFO: using default physical extent size 4 MB vgcreate -- INFO: maximum logical volume size is 255.99 Gigabyte vgcreate -- doing automatic backup of volume group "test" vgcreate -- volume group "test" successfully created and activated 现在我们有一个空的卷组(VG),让我们来检查一下: # vgdisplay -v test --- Volume group --- VG Name test VG Access read/write VG Status available/resizable VG # 0 MAX LV 256 Cur LV 0 Open LV 0 MAX LV Size 255.99 GB Max PV 256 Cur PV 2 Act PV 2 VG Size 184 MB PE Size 4 MB Total PE 46 Alloc PE / Size 0 / 0 Free PE / Size 46 / 184 MB --- No logical volumes defined in test --- --- Physical volumes --- PV Name (#) /dev/hda3 (2) PV Status available / allocatable Total PE / Free PE 13 / 13 PV Name (#) /dev/hdb2 (1) PV Status available / allocatable Total PE / Free PE 33 / 33 我们看到没有逻辑卷(LV)定义,因此我们要补上它.我们将在“test”卷组(PV)中创建一个50MB的逻辑卷,叫做“HOWTO”: # lvcreate -L 50M -n HOWTO test lvcreate -- rounding up size to physical extent boundary "52 MB" lvcreate -- doing automatic backup of "test" lvcreate -- logical volume "/dev/test/HOWTO" successfully created Ok,到这里,我们创建一个文件系统: # mkfs.ext3 /dev/test/HOWTO mke2fs 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09 Filesystem label= OS type: Linux Block size=1024 (log=0) 拥有帝国一切,皆有可能。欢迎访问phome.net Fragment size=1024 (log=0) 13328 inodes, 53248 blocks 2662 blocks (5.00%) reserved for the super user First data block=1 7 block groups 8192 blocks per group, 8192 fragments per group 1904 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961 Writing inode tables: done Writing superblocks and filesystem accounting information: done # mount /dev/test/HOWTO /mnt # ls /mnt |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于lvm命令总结的所有评论