linux CentOS/redhat 6.5 LVM分区使用详解




linux CentOS/redhat 6.5 LVM分区使用详解

2022-07-20 20:24:22 网络知识 官方管理员

1,介绍

LVM是逻辑盘卷管理(LogicalVolumeManager)的简称,它是Linux环境下对磁盘分区进行管理的一种机制,LVM是建立在硬盘和分区之上的一个逻辑层,来提高磁盘分LVM
区管理的灵活性。前面谈到,LVM是在磁盘分区文件系统之间添加的一个逻辑层,来为文件系统屏蔽下层磁盘分区布局,提供一个抽象的盘卷,在盘卷上建立文件系统。物理卷(physicalvolume)物理卷就是指硬盘分区或从逻辑上与磁盘分区具有同样功能的设备(如RAID),是LVM的基本存储逻辑块,但和基本的物理存储介质(如分区、磁盘等)比较,却包含有与LVM相关的管理参数。

2,创建
[root@cn-iss-install-01mapper]#fdisk-l
[root@cn-iss-install-01mapper]#fdisk/dev/sdb
DevicecontainsneitheravalidDOSpartitiontable,norSun,SGIorOSFdisklabel
BuildinganewDOSdisklabelwithdiskidentifier0x874c7742.
Changeswillremaininmemoryonly,untilyoudecidetowritethem.
Afterthat,ofcourse,thepreviouscontentwon'tberecoverable.
Warning:invalidflag0x0000ofpartitiontable4willbecorrectedbyw(rite)
WARNING:DOS-compatiblemodeisdeprecated.It'sstronglyrecommendedto
switchoffthemode(command'c')andchangedisplayunitsto
sectors(command'u').
Command(mforhelp):m
Commandaction
atoggleabootableflag
beditbsddisklabel
ctogglethedoscompatibilityflag
ddeleteapartition
llistknownpartitiontypes
mprintthismenu
naddanewpartition
ocreateanewemptyDOSpartitiontable
pprintthepartitiontable
qquitwithoutsavingchanges
screateanewemptySundisklabel
tchangeapartition'ssystemid
uchangedisplay/entryunits
vverifythepartitiontable
wwritetabletodiskandexit
xextrafunctionality(expertsonly)
Command(mforhelp):p
Disk/dev/sdb:96.6GB,96636764160bytes
255heads,63sectors/track,11748cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x874c7742
DeviceBootStartEndBlocksIdSystem
Command(mforhelp):n
Commandaction
eextended
pprimarypartition(1-4)
p
Partitionnumber(1-4):1
Firstcylinder(1-11748,default1):
Usingdefaultvalue1
Lastcylinder,+cylindersor+size{K,M,G}(1-11748,default11748):+80G
Command(mforhelp):p
Disk/dev/sdb:96.6GB,96636764160bytes
255heads,63sectors/track,11748cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x874c7742
DeviceBootStartEndBlocksIdSystem
/dev/sdb111044483891398+5Extended
Command(mforhelp):w
Thepartitiontablehasbeen altered!
Callingioctl()tore-readpartitiontable.
Syncingdisks.
[root@cn-iss-install-01mapper]#rebootor
[root@cn-iss-install-01Packages]#partprobe
[root@cn-iss-install-01~]#fdisk-l
Disk/dev/sda:17.2GB,17179869184bytes
64heads,32sectors/track,16384cylinders
Units=cylindersof2048*512=1048576bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x0005b1c0
DeviceBootStartEndBlocksIdSystem
/dev/sda1*225125600083Linux
Partition1doesnotendoncylinderboundary.
/dev/sda225216384165201928eLinuxLVM
Partition2doesnotendoncylinderboundary.
Disk/dev/sdb:96.6GB,96636764160bytes
255heads,63sectors/track,11748cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x874c7742
DeviceBootStartEndBlocksIdSystem
/dev/sdb111044483891398+5Extended
Disk/dev/mapper/VG00-LV_rootfs:16.4GB,16374562816bytes
255heads,63sectors/track,1990cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x00000000
Disk/dev/mapper/VG00-LV_swap:536MB,536870912bytes
255heads,63sectors/track,65cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x00000000
[root@cn-iss-install-01~]#
[root@cn-iss-install-01Packages]#pvcreate/dev/sdb1
Writingphysicalvolumedatatodisk"/dev/sdb1"
Physicalvolume"/dev/sdb1"successfullycreated
[root@cn-iss-install-01Packages]#
[root@cn-iss-install-01Packages]#vgcreatevg03/dev/sdb1
Volumegroup"vg03"successfullycreated
[root@cn-iss-install-01Packages]#lvcreate-L83G-nvgdatavg03
[root@cn-iss-install-01Packages]#mke2fs/dev/vg03/vgdata
mke2fs1.41.12(17-May-2010)
Filesystemlabel=
OStype:Linux
Blocksize=4096(log=2)
Fragmentsize=4096(log=2)
Stride=0blocks,Stripe width=0blocks
5439488inodes,21757952blocks
1087897blocks(5.00%)reservedforthesuperuser
Firstdatablock=0
Maximumfilesystemblocks=4294967296
664blockgroups
32768blockspergroup,32768fragmentspergroup
8192inodespergroup
Superblockbackupsstoredonblocks:
32768,98304,163840,229376,294912,819200,884736,1605632,2654208,
4096000,7962624,11239424,20480000
Writinginodetables:done
Writingsuperblocksandfilesystemaccountinginformation:
done
Thisfilesystemwillbeautomaticallycheckedevery23mountsor
180days,whichevercomesfirst.Usetune2fs-cor-itooverride.
[root@cn-iss-install-01Packages]#
[root@cn-iss-install-01Packages]#
[root@cn-iss-install-01Packages]#mkf
mkfifomkfs.cramfsmkfs.ext3mkfs.ext4dev
mkfsmkfs.ext2mkfs.ext4
[root@cn-iss-install-01Packages]#mkfs.ext4/dev/vg03/vgdata
mke2fs1.41.12(17-May-2010)
Filesystemlabel=
OStype:Linux
Blocksize=4096(log=2)
Fragmentsize=4096(log=2)
Stride=0blocks,Stripe width=0blocks
5439488inodes,21757952blocks
1087897blocks(5.00%)reservedforthesuperuser
Firstdatablock=0
Maximumfilesystemblocks=4294967296
664blockgroups
32768blockspergroup,32768fragmentspergroup
8192inodespergroup
Superblockbackupsstoredonblocks:
32768,98304,163840,229376,294912,819200,884736,1605632,2654208,
4096000,7962624,11239424,20480000
Writinginodetables:done
Creatingjournal(32768blocks):done
Writingsuperblocksandfilesystemaccountinginformation:done
Thisfilesystemwillbeautomaticallycheckedevery37mountsor
180days,whichevercomesfirst.Usetune2fs-cor-itooverride.
[root@cn-iss-install-01Packages]#
[root@cn-iss-install-01spool]#mount/dev/vg03/vgdata/var/spool/repo/
[root@cn-iss-install-01spool]#cdrepo/
[root@cn-iss-install-01repo]#ls
lost+found
[root@cn-iss-install-01repo]#pwd
/var/spool/repo
[root@cn-iss-install-01repo]#
3,常用检查命令:
[root@cn-iss-install-01/]#pvdisplay
[root@cn-iss-install-01/]#vgdisplay
[root@cn-iss-install-01/]#lvdisplay
[root@cn-iss-install-01/]#pvcreate
Pleaseenteraphysicalvolumepath
Run`pvcreate--help'formoreinformation.
[root@cn-iss-install-01/]#vgcreate
Pleaseprovidevolumegroupnameandphysicalvolumes
Run`vgcreate--help'formoreinformation.
[root@cn-iss-install-01/]#lvcreate
Pleaseprovideavolumegroupname
Run`lvcreate--help'formoreinformation.
[root@cn-iss-install-01/]#vgextend
Pleaseentervolumegroupnameandphysicalvolume(s)
Run`vgextend--help'formoreinformation.
[root@cn-iss-install-01/]#lvextend
Pleasespecifyeithersizeorextentsbutnotboth.
Run`lvextend--help'formoreinformation.
[root@cn-iss-install-01/]#


发表评论:

最近发表
网站分类
标签列表