VMWare linux 虚拟机扩容
首先通过VMWare修改虚拟机参数,增加虚拟机磁盘空间(请参考相关资料),其次在虚拟机中加入扩容的磁盘空间。1、使用parted查看可分配的空间[root@stest ~]# partedGNU Parted 1.8.1使用 /dev/sdaWelcome to GNU Parted! Type 'help' to view a list of commands.(part
首先通过VMWare修改虚拟机参数,增加虚拟机磁盘空间(请参考相关资料),其次在虚拟机中加入扩容的磁盘空间。
1、使用parted查看可分配的空间
[root@stest ~]# parted
GNU Parted 1.8.1
使用 /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 38.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system 标志
1 32.3kB 107MB 107MB 主分区 ext3 启动
2 107MB 17.2GB 17.1GB 主分区 lvm
17.2GB 38.7GB 21.5GB Free Space
可以看到有新增加的21.5GB的空间尚未被分配。
2、使用fdisk -l查看磁盘分区
[root@stest ~]# fdisk -l
Disk /dev/sda: 38.6 GB, 38654705664 bytes
255 heads, 63 sectors/track, 4699 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 2088 16667437+ 8e Linux LVM
3、查看磁盘分区,先输入fdisk /dev/sda,接着输入p,显示磁盘空间分配情况,可见已分配2088个柱面,共有4699个柱面。
[root@stest ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 4699.
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: 38.6 GB, 38654705664 bytes
255 heads, 63 sectors/track, 4699 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 2088 16667437+ 8e Linux LVM
4、创建新的磁盘分区,将新的磁盘分区设置为扩展分区,这里分区数为3,起始柱面使用缺省值2089,结束柱面使用缺省值4699,最后输入w,保存修改。
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Partition number (1-4): 3
First cylinder (2089-4699, default 2089):
Using default value 2089
Last cylinder or +size or +sizeM or +sizeK (2089-4699, default 4699):
Using default value 4699
Command (m for help): w
The partition table has been altered!
保存完成后重启服务器。
5、在扩展分区上创建逻辑分区,输入n,选l创建逻辑分区,起始柱面、结束柱面号直接敲回车,使用缺省值,只建一个逻辑分区,最后输入w保存修改。
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (2089-4699, default 2089):
Using default value 2089
Last cylinder or +size or +sizeM or +sizeK (2089-4699, default 4699):
Using default value 4699
Command (m for help): w
The partition table has been altered!
重启系统。
6、格式化文件系统,使用mkfs命令对新建磁盘分区进行格式化
[root@stest ~]# mkfs -t ext3 /dev/sda5
mke2fs 1.39 (29-May-2006)
warning: 326 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=4294967296
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 34 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
使用mount命令挂载磁盘:
[root@stest ~]# mount -t ext3 /dev/sda5 /home/weblogic
7、mount磁盘分区到文件系统,这里先创建/home/weblogic目录,然后使用vi命令在/etc/fstab文件中加入:
/dev/sda4 /home/weblogic ext3 defaults 0 0
保存修改,重启系统,这样以后使用便会自动挂载新的磁盘分区。
更多推荐
所有评论(0)