|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
欢迎大家来到仓酷云论坛!操纵情况:
[root@linuxidc~]#uname-a
Linuxlinuxidc2.6.32-358.18.1.el6.x86_64#1SMPWedAug2817:19:38UTC2013x86_64x86_64x86_64GNU/Linux
近况剖析:
体系有两个硬盘,第一个硬盘107G,“/”分区空间事先分区时只给了7.7G太小,空间即刻占完。如今体系有第二个硬盘sdb巨细为16GB,但愿把sdb的一切空间到场到“/”分区中,是其空间容量从7.7GB酿成7.7GB+16GB(约2.4GB)。(固然假如这里只要一个硬盘sda,有良多空间还没有利用能够举行一样的操纵)
操纵步调以下:
第一步、检察本机现有分区情形
[root@linuxidc~]#df-h
文件体系容量已用可用已用%%挂载点
/dev/mapper/VolGroup-lv_root
7.7G7.1G155M98%/
tmpfs3.9G296K3.9G1%/dev/shm
/dev/sda1485M64M396M14%/boot
/dev/sda383G350M79G1%/media
第二步、检察本机的磁盘情形
[root@linuxidc~]#fdisk-l
Disk/dev/sda:107.4GB,107374182400bytes
255heads,63sectors/track,13054cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x000dc0ad
DeviceBootStartEndBlocksIdSystem
/dev/sda1*16451200083Linux
Partition1doesnotendoncylinderboundary.
/dev/sda2642089162641928eLinuxLVM
/dev/sda320901305488076362+83Linux
Disk/dev/mapper/VolGroup-lv_root:8325MB,8325693440bytes
255heads,63sectors/track,1012cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x00000000
Disk/dev/mapper/VolGroup-lv_swap:8325MB,8325693440bytes
255heads,63sectors/track,1012cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x00000000
注重:此时还没有在EXSI5.0中增加第二块硬盘
[root@linuxidc~]#
第三步、增加第二块硬盘
检察此时体系磁盘情形
root@linuxidc~]#fdisk-l
Disk/dev/sda:107.4GB,107374182400bytes
255heads,63sectors/track,13054cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x000dc0ad
DeviceBootStartEndBlocksIdSystem
/dev/sda1*16451200083Linux
Partition1doesnotendoncylinderboundary.
/dev/sda2642089162641928eLinuxLVM
/dev/sda320901305488076362+83Linux
Disk/dev/sdb:17.2GB,17179869184bytes
255heads,63sectors/track,2088cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x00000000
Disk/dev/mapper/VolGroup-lv_root:8325MB,8325693440bytes
255heads,63sectors/track,1012cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x00000000
Disk/dev/mapper/VolGroup-lv_swap:8325MB,8325693440bytes
255heads,63sectors/track,1012cylinders
Units=cylindersof16065*512=8225280bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x00000000
能够看到我们新增加的硬盘sdb
[root@linuxidc~]#
第四步、对第二块硬盘sdb举行分区
[root@linuxidc~]#fdisk/dev/sdb
DevicecontainsneitheravalidDOSpartitiontable,norSun,SGIorOSFdisklabel
BuildinganewDOSdisklabelwithdiskidentifier0xfa4abbdc.
Changeswillremaininmemoryonly,untilyoudecidetowritethem.
Afterthat,ofcourse,thepreviouscontentwontberecoverable.
Warning:invalidflag0x0000ofpartitiontable4willbecorrectedbyw(rite)
WARNING:DOS-compatiblemodeisdeprecated.Itsstronglyrecommendedto
switchoffthemode(commandc)andchangedisplayunitsto
sectors(commandu).
Command(mforhelp):m
Commandaction
atoggleabootableflag
beditbsddisklabel
ctogglethedoscompatibilityflag
ddeleteapartition
llistknownpartitiontypes
mprintthismenu
naddanewpartition
ocreateanewemptyDOSpartitiontable
pprintthepartitiontable
qquitwithoutsavingchanges
screateanewemptySundisklabel
tchangeapartitionssystemid
uchangedisplay/entryunits
vverifythepartitiontable
wwritetabletodiskandexit
xextrafunctionality(expertsonly)
Command(mforhelp):n
Commandaction
eextended
pprimarypartition(1-4)
p
Partitionnumber(1-4):4
Firstcylinder(1-2088,default1):
Usingdefaultvalue1
Lastcylinder,+cylindersor+size{K,M,G}(1-2088,default2088):
Usingdefaultvalue2088
Command(mforhelp):w
Thepartitiontablehasbeenaltered!
Callingioctl()tore-readpartitiontable.
Syncingdisks.
申明:下面操纵对sdb硬盘举行了分区操纵,设为sdb4分区了(固然下面创建的主分区能够为1-4中的恣意一个,我这里选择的4)。
第五步、对新创建的sdb4分区举行格局
[root@linuxidc~]#mkfs.ext4/dev/sdb4
mke2fs1.41.12(17-May-2010)
文件体系标签=
操纵体系:Linux
块巨细=4096(log=2)
分块巨细=4096(log=2)
Stride=0blocks,Stripewidth=0blocks
1048576inodes,4192957blocks
209647blocks(5.00%)reservedforthesuperuser
第一个数据块=0
Maximumfilesystemblocks=4294967296
128blockgroups
32768blockspergroup,32768fragmentspergroup
8192inodespergroup
Superblockbackupsstoredonblocks:
32768,98304,163840,229376,294912,819200,884736,1605632,2654208,
4096000
正在写进inode表:完成
Creatingjournal(32768blocks):完成
Writingsuperblocksandfilesystemaccountinginformation:done完成
Thisfilesystemwillbeautomaticallycheckedevery20mountsor
180days,whichevercomesfirst.Usetune2fs-cor-itooverride.
申明:将sdb4分区格局化为ext4格局,由于CentOS装置是体系的格局ext4,以是这里要注重一下。
第六步、格局后的sdb4分区增加为物理卷
[root@linuxidc~]#pvcreate/dev/sdb4
Physicalvolume"/dev/sdb4"successfullycreated
第七步、检察以后体系的物理卷(PV)情形
[root@linuxidc~]#pvdisplay
---Physicalvolume---
PVName/dev/sda2
VGNameVolGroup
PVSize15.51GiB/notusable3.00MiB
Allocatableyes(butfull)
PESize4.00MiB
TotalPE3970
FreePE0
AllocatedPE3970
PVUUIDUp77sG-sNKf-Ja0k-crBf-N0wz-a5hy-T6sVFh
"/dev/sdb4"isanewphysicalvolumeof"15.99GiB"
---NEWPhysicalvolume---
PVName/dev/sdb4
VGName
PVSize15.99GiB
AllocatableNO
PESize0
TotalPE0
FreePE0
AllocatedPE0
PVUUIDGqnw7N-HooX-S2Nz-1NIZ-YpOe-g0jo-grG1rQ
申明:能够看到增加的新物理卷sdb4,巨细都切合我们增加时的设置
第八步、检察以后卷组情形
[root@linuxidc~]#vgdisplay
---Volumegroup---
VGNameVolGroup
SystemID
Formatlvm2
MetadataAreas1
MetadataSequenceNo3
VGAccessread/write
VGStatusresizable
MAXLV0
CurLV2
OpenLV2
MaxPV0
CurPV1
ActPV1
VGSize15.51GiB
PESize4.00MiB
TotalPE3970
AllocPE/Size3970/15.51GiB
FreePE/Size0/0
VGUUIDPPrifh-glzl-nnxX-YkBm-xJ1s-rgnw-d1WsJd
第九步、将分区sdb4转换为扩大分区
[root@linuxidc~]#vgextendVolGroup/dev/sdb4
Volumegroup"VolGroup"successfullyextended
第十步、检察以后的逻辑卷
[root@linuxidc~]#lvdisplay
---Logicalvolume---
LVPath/dev/VolGroup/lv_root
LVNamelv_root
VGNameVolGroup
LVUUIDdCIsej-0NWX-bVFe-bT6L-c4eY-oy4G-9lNBOC
LVWriteAccessread/write
LVCreationhost,time,
LVStatusavailable
#open1
LVSize7.75GiB
CurrentLE1985
Segments1
Allocationinherit
Readaheadsectorsauto
-currentlysetto256
Blockdevice253:0
---Logicalvolume---
LVPath/dev/VolGroup/lv_swap
LVNamelv_swap
VGNameVolGroup
LVUUIDK5bxJo-2SmM-6NCU-mBJP-Qzp1-ZODH-nbLK0k
LVWriteAccessread/write
LVCreationhost,time,
LVStatusavailable
#open1
LVSize7.75GiB
CurrentLE1985
Segments1
Allocationinherit
Readaheadsectorsauto
-currentlysetto256
Blockdevice253:1
申明:这里能够看到“/”根分区的路径称号为:/dev/VolGroup/lv_root
第十一步、检察扩大后的卷组情形
[root@linuxidc~]#vgdisplay
---Volumegroup---
VGNameVolGroup
SystemID
Formatlvm2
MetadataAreas2
MetadataSequenceNo4
VGAccessread/write
VGStatusresizable
MAXLV0
CurLV2
OpenLV2
MaxPV0
CurPV2
ActPV2
VGSize31.50GiB
PESize4.00MiB
TotalPE8064
AllocPE/Size3970/15.51GiB
FreePE/Size4094/15.99GiB
VGUUIDPPrifh-glzl-nnxX-YkBm-xJ1s-rgnw-d1WsJd
申明:扩大后的卷子情形,能够看出巨细增添了16GB(与第八步中的对照)
第十二步、将新增的逻辑卷全体扩大到“/”分区中
[root@linuxidc~]#lvextend-L+15.99G/dev/VolGroup/lv_root
Roundingsizetoboundarybetweenphysicalextents:15.99GiB
Extendinglogicalvolumelv_rootto23.75GiB
Logicalvolumelv_rootsuccessfullyresized
申明:这里sdb4统共有16G,以是把16BG全体增加给根分区。
第十三步、检察“/”根分区格局,偏重新革新根分区的巨细
[root@linuxidc~]#e2fsck-f/dev/VolGroup/lv_root
e2fsck1.41.12(17-May-2010)
/dev/VolGroup/lv_rootismounted.
e2fsck:没法持续,中断.
[root@linuxidc~]#resize2fs/dev/VolGroup/lv_root
resize2fs1.41.12(17-May-2010)
Filesystemat/dev/VolGroup/lv_rootismountedon/;on-lineresizingrequired
olddesc_blocks=1,new_desc_blocks=2
Performinganon-lineresizeof/dev/VolGroup/lv_rootto6224896(4k)blocks.
Thefilesystemon/dev/VolGroup/lv_rootisnow6224896blockslong.
申明:下令resize2fs即革新根分区“/dev/VolGroup/lv_root”的容量。
第十三步、检察革新后根分区的巨细
[root@linuxidc~]#df-h
文件体系容量已用可用已用%%挂载点
/dev/mapper/VolGroup-lv_root
24G7.1G16G32%/
tmpfs3.9G144K3.9G1%/dev/shm
/dev/sda383G350M79G1%/media/Lucene
申明:能够看到根分区的巨细有7.7G酿成了24G,重启一下体系再来看情形。此时就能够持续装置软件了,不会提醒空间不敷了。
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们! |
|