Linux上如何扩展VolGroup00?
首先说明一下🚐情况,在🏴VmWare上建立【shàng jiàn lì】🍚了一个Linux 虚拟机,当时硬【dāng shí yìng】🥡盘只分【pán zhī fèn】🍇配了【pèi le】20G用着用着发现硬盘不够了需要扩展【yào kuò zhǎn】。
1.在VMware中👔将硬盘扩展【pán kuò zhǎn】🔏到40G(这个【gè】🎴鼠标点【diǎn】点【diǎn】🎳就好了【jiù hǎo le】) 2.输入【shū rù】🈁fdisk /dev/sda看看硬盘有没有变大🛀
[root@localhost ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 5221.
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): p
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
这里我们发现🆔一共有5221cylinders,可是结【kě shì jié】束却在【shù què zài】2610cylinders,这说明【zhè shuō míng】硬🐽盘有空【pán yǒu kōng】余👴,说明硬🐽盘扩展【pán kuò zhǎn】🔏成功✡。
3.新建分区【fèn qū】💡
[root@localhost ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 5221.
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): n //创建一【chuàng jiàn yī】个【gè】分区【fèn qū】🌻(卷)
Command action //问你是【wèn nǐ shì】🆗主分区【zhǔ fèn qū】🎸还是扩【hái shì kuò】展【zhǎn】📈分区【fèn qū】💡,我们输【wǒ men shū】🆒入p代表主分区【zhǔ fèn qū】🎸
e extended
p primary partition (1-4)
p
Partition number (1-4): 3 //问你是【wèn nǐ shì】🆗第几个【dì jǐ gè】分区【fèn qū】🌻,我这里前面有两个分【liǎng gè fèn】区【qū】🌻了,输入【shū rù】🈁3表示【biǎo shì】建立第三个【gè】分区【fèn qū】🌻
First cylinder (2611-5221, default 2611): //问你分【wèn nǐ fèn】🙄区【qū】从哪🕎个【gè】🎴cylinder开始😚,保持默认【rèn】
Using default value 2611
Last cylinder or +size or +sizeM or +sizeK (2611-5221, default 5221):
Using default value 5221 //问你分【wèn nǐ fèn】🙄区【qū】〽在哪个【gè】🎴cylinder结束【jié shù】,我们输【wǒ men shū】🆒入回车,表示【biǎo shì】硬盘的【pán de】🍪最后一【zuì hòu yī】个【gè】😬cylinder
Command (m for help): t //输入【shū rù】🈁t我们修🎹改刚刚【gǎi gāng gāng】🧤建立的【de】🍪分区【fèn qū】格👸式【shì】
Partition number (1-4): 3 //问我们【wèn wǒ men】♓改哪个【gè】分区【fèn qū】🌻,输入【shū rù】🈁3改第三【gǎi dì sān】个【gè】🎴
Hex code (type L to list codes): 8e //改成什么格式【shì】😪的【de】🍪,输入【shū rù】🈁8e,表示【biǎo shì】Linux LVM格式【shì】
Changed system type of partition 3 to 8e (Linux LVM)
Command (m for help): p //输入【shū rù】🈁p查看修改以后🐫的【de】🍪状态
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
/dev/sda3 2611 5221 20972857+ 8e Linux LVM
Command (m for help): w //输入【shū rù】🈁w保存,这里可能要求【néng yào qiú】重启【chóng qǐ】
4.对新建的【de】🍪分区【fèn qū】格👸式化【shì huà】,输入【shū rù】🈁#mkfs.ext3 /dev/sda3
[root@localhost ~]# mkfs.ext3 /dev/sda3
mke2fs 1.39 (29-May-2006)
warning: 334 blocks unused.
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2626560 inodes, 5242880 blocks
262160 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
160 block groups
32768 blocks per group, 32768 fragments per group
16416 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
5.创建一【chuàng jiàn yī】个【gè】🎴PV,输入【shū rù】🈁#pvcreate /dev/sda3
[root@localhost ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
6.将建立好的【hǎo de】🍪PV加入到现有的【de】🍪VG中👔,输入【shū rù】🈁#vgextend VolGroup00 /dev/sda3 (注意这里第二个【gè】🎴参数为VG的【de】🍪名字)
[root@localhost ~]# vgextend VolGroup00 /dev/sda3
Volume group "VolGroup00" successfully extended
7.扩展【zhǎn】📈LV,输入【shū rù】🈁#lvextend -L +20G /dev/VolGroup00/LogVol00
[root@localhost ~]# lvextend -L +20G /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 35.94 GB
Logical volume LogVol00 successfully resized
8.从新识别一下LV的【de】🍪容量,输入【shū rù】🈁#resize2fs /dev/VolGroup00/LogVol00
[root@localhost ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 9420800 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 9420800 blocks long.
9.至此扩🕕展就已经成功了【le】🏋,你可以【nǐ kě yǐ】输入【shū rù】df -l查看新🧀的容量🍘
[root@localhost ~]# df -l
文件系统【xì tǒng】 1K-块 已用 可用🦎 已用% 挂载点【guà zǎi diǎn】
/dev/mapper/VolGroup00-LogVol00
36505664 15045120 19579916 44% /
/dev/sda1 101086 12097 83770 13% /boot
tmpfs 1037748 0 1037748 0% /dev/shm
关键词:Linux
阅读本文后您有什么感想? 已有 人给出评价!
- 0
- 0
- 0
- 0
- 0
- 0