vmware虚拟机调整ubuntu10.04分区大小
来源:互联网 发布:jdk 7u60 linux x64 编辑:程序博客网 时间:2024/05/19 22:24
vmware20G分区大小已经接近用完了。
开机一直提示容量小,
容量扩充,vmware有图形界面的选项。在hard disk哪里调整。
调整之后,新增加了5G的容量,可以用ubuntu自带的disk utility来格式化和挂载。
但是新分区,默认是挂在到/media下的,开机还是会提示容量小。/分区的并没有被扩大。
因此需要有其他的办法来解决。
=============================================================
参考了一篇使用lvm分区的文章。
感觉有点复杂,有专门的一篇英文文章讲这个过程。
zhangbin@ubuntu:~$ sudo su
[sudo] password for zhangbin:
froot@ubuntu:/home/zhangbin# fdisk -l
Disk /dev/sda: 26.8 GB, 26843545600 bytes 磁盘空间扩大了
255 heads, 63 sectors/track, 3263 cylinders 255头 63个扇区 每 磁道 3263个圆柱体
Units = cylinders of 16065 * 512 = 8225280 bytes 单元
Sector size (logical/physical): 512 bytes / 512 bytes 扇区大小(逻辑/物理) 都是512字节。
I/O size (minimum/optimal): 512 bytes / 512 bytes I/O 大小(最小/最大) 都是512字节。
Disk identifier: 0x00030124 设备识别码
启动设备加* 起始 结束 块 id 系统
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2497 20051968 83 Linux
/dev/sda2 2497 2611 916481 5 Extended 有一个扩展分区
/dev/sda3 2612 3263 5237190 83 Linux
/dev/sda5 2497 2611 916480 82 Linux swap / Solaris
root@ubuntu:/home/zhangbin# fdisk
Usage:
fdisk [options] <disk> change partition table
fdisk [options] -l <disk> list partition table(s)
fdisk -s <partition> give partition size(s) in blocks
Options:
-b <size> sector size (512, 1024, 2048 or 4096)
-c switch off DOS-compatible mode
-h print help
-u <size> give sizes in sectors instead of cylinders
-v print version
-C <number> specify the number of cylinders
-H <number> specify the number of heads
-S <number> specify the number of sectors per track
root@ubuntu:/home/zhangbin# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 19737268 17850536 884136 96% /
none 250352 256 250096 1% /dev
none 254580 168 254412 1% /dev/shm
none 254580 112 254468 1% /var/run
none 254580 0 254580 0% /var/lock
none 254580 0 254580 0% /lib/init/rw
/dev/sda3 5154884 141304 4751724 3% /media/ExpandP
root@ubuntu:/home/zhangbin# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 19737268 17850536 884136 96% /
none 250352 256 250096 1% /dev
none 254580 168 254412 1% /dev/shm
none 254580 112 254468 1% /var/run
none 254580 0 254580 0% /var/lock
none 254580 0 254580 0% /lib/init/rw
/dev/sda3 5154884 141304 4751724 3% /media/ExpandP 新分的那个区,我起名叫做ExpandP
root@ubuntu:/home/zhangbin# mount /dev/sda4 /
mount: special device /dev/sda4 does not exist
root@ubuntu:/home/zhangbin# mount /dev/sda3 / 挂到/上。
root@ubuntu:/home/zhangbin# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 19737268 17850536 884136 96% /
none 250352 256 250096 1% /dev
none 254580 168 254412 1% /dev/shm
none 254580 112 254468 1% /var/run
none 254580 0 254580 0% /var/lock
none 254580 0 254580 0% /lib/init/rw
/dev/sda3 5154884 141304 4751724 3% /media/ExpandP
/dev/sda3 19737268 17850536 884136 96% /
root@ubuntu:/home/zhangbin# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 19737268 17850536 884136 96% /
none 250352 256 250096 1% /dev
none 254580 168 254412 1% /dev/shm
none 254580 112 254468 1% /var/run
none 254580 0 254580 0% /var/lock
none 254580 0 254580 0% /lib/init/rw
/dev/sda3 19737268 17850536 884136 96% /
root@ubuntu:/home/zhangbin# mount /dev/sda3 /
mount: /dev/sda3 already mounted or / busy
mount: according to mtab, /dev/sda1 is already mounted on / mtab是个mount表吧。
root@ubuntu:/# umount /dev/sda3 从/上卸载sda3
umount: /: device is busy. 这个是什么歌意思呢?
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
root@ubuntu:/home/zhangbin# apt-get install lvm 名字叫做lvm2了
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package lvm
root@ubuntu:/home/zhangbin# pvcreate
The program 'pvcreate' is currently not installed. You can install it by typing:
apt-get install lvm2
root@ubuntu:/home/zhangbin# apt-get install lvm2
root@ubuntu:/home/zhangbin# apt-get install lvm2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libdevmapper-event1.02.1 watershed
The following NEW packages will be installed:
libdevmapper-event1.02.1 lvm2 watershed
0 upgraded, 3 newly installed, 0 to remove and 221 not upgraded.
Need to get 447kB of archives.
After this operation, 1,282kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://Ubuntu.cn99.com/ubuntu/ lucid-security/main libdevmapper-event1.02.1 2:1.02.39-1ubuntu4.1 [27.5kB]
Get:2 http://Ubuntu.cn99.com/ubuntu/ lucid/main watershed 5 [10.7kB]
Get:3 http://Ubuntu.cn99.com/ubuntu/ lucid-security/main lvm2 2.02.54-1ubuntu4.1 [409kB]
Fetched 447kB in 60s (7,413B/s)
Selecting previously deselected package libdevmapper-event1.02.1.
(Reading database ... 151964 files and directories currently installed.)
Unpacking libdevmapper-event1.02.1 (from .../libdevmapper-event1.02.1_2%3a1.02.39-1ubuntu4.1_i386.deb) ...
Selecting previously deselected package watershed.
Unpacking watershed (from .../archives/watershed_5_i386.deb) ...
Selecting previously deselected package lvm2.
Unpacking lvm2 (from .../lvm2_2.02.54-1ubuntu4.1_i386.deb) ...
Processing triggers for man-db ...
Setting up libdevmapper-event1.02.1 (2:1.02.39-1ubuntu4.1) ...
Setting up watershed (5) ...
update-initramfs: deferring update (trigger activated)
Setting up lvm2 (2.02.54-1ubuntu4.1) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
/sbin/ldconfig.real: /usr/lib/libavfilter.so.1 is not a symbolic link
/sbin/ldconfig.real: /usr/lib/libavutil.so.50 is not a symbolic link
/sbin/ldconfig.real: /usr/lib/libavdevice.so.52 is not a symbolic link
/sbin/ldconfig.real: /usr/lib/libavcore.so.0 is not a symbolic link
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-2.6.32-26-generic
root@ubuntu:/home/zhangbin#
root@ubuntu:/home/zhangbin# parted
GNU Parted 2.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 26.8GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 20.5GB 20.5GB primary ext4 boot
2 20.5GB 21.5GB 938MB extended
5 20.5GB 21.5GB 938MB logical linux-swap(v1)
3 21.5GB 26.8GB 5363MB primary ext4
(parted) df
align-check TYPE N check partition N for TYPE(min|opt)
alignment
check NUMBER do a simple check on the file system
cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition
help [COMMAND] print general help, or help on
COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition
table)
mkfs NUMBER FS-TYPE make a FS-TYPE file system on
partition NUMBER
mkpart PART-TYPE [FS-TYPE] START END make a partition
mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system
move NUMBER START END move partition NUMBER
name NUMBER NAME name partition NUMBER as NAME
print [devices|free|list,all|NUMBER] display the partition table,
available devices, free space, all found partitions, or a particular
partition
quit exit program
rescue START END rescue a lost partition near START
and END
resize NUMBER START END resize partition NUMBER and its file
system
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
set NUMBER FLAG STATE change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]] toggle the state of FLAG on partition
NUMBER
unit UNIT set the default unit to UNIT
version display the version number and
copyright information of GNU Parted
(parted) df -l
align-check TYPE N check partition N for TYPE(min|opt)
alignment
check NUMBER do a simple check on the file system
cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition
help [COMMAND] print general help, or help on
COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition
table)
mkfs NUMBER FS-TYPE make a FS-TYPE file system on
partition NUMBER
mkpart PART-TYPE [FS-TYPE] START END make a partition
mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system
move NUMBER START END move partition NUMBER
name NUMBER NAME name partition NUMBER as NAME
print [devices|free|list,all|NUMBER] display the partition table,
available devices, free space, all found partitions, or a particular
partition
quit exit program
rescue START END rescue a lost partition near START
and END
resize NUMBER START END resize partition NUMBER and its file
system
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
set NUMBER FLAG STATE change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]] toggle the state of FLAG on partition
NUMBER
unit UNIT set the default unit to UNIT
version display the version number and
copyright information of GNU Parted
align-check TYPE N check partition N for TYPE(min|opt)
alignment
check NUMBER do a simple check on the file system
cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition
help [COMMAND] print general help, or help on
COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition
table)
mkfs NUMBER FS-TYPE make a FS-TYPE file system on
partition NUMBER
mkpart PART-TYPE [FS-TYPE] START END make a partition
mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system
move NUMBER START END move partition NUMBER
name NUMBER NAME name partition NUMBER as NAME
print [devices|free|list,all|NUMBER] display the partition table,
available devices, free space, all found partitions, or a particular
partition
quit exit program
rescue START END rescue a lost partition near START
and END
resize NUMBER START END resize partition NUMBER and its file
system
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
set NUMBER FLAG STATE change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]] toggle the state of FLAG on partition
NUMBER
unit UNIT set the default unit to UNIT
version display the version number and
copyright information of GNU Parted
(parted) quit
root@ubuntu:/home/zhangbin# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 19737268 17853368 881304 96% /
none 250352 256 250096 1% /dev
none 254580 168 254412 1% /dev/shm
none 254580 112 254468 1% /var/run
none 254580 0 254580 0% /var/lock
none 254580 0 254580 0% /lib/init/rw
/dev/sda3 5154884 141304 4751724 3% /media/ExpandP
root@ubuntu:/home/zhangbin# umount /media/ExpandP
root@ubuntu:/home/zhangbin# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 19737268 17853392 881280 96% /
none 250352 256 250096 1% /dev
none 254580 168 254412 1% /dev/shm
none 254580 112 254468 1% /var/run
none 254580 0 254580 0% /var/lock
none 254580 0 254580 0% /lib/init/rw
root@ubuntu:/home/zhangbin#
root@ubuntu:/home/zhangbin# pvs --help
pvs: Display information about physical volumes 显示物理卷得信息
pvs
[-a|--all]
[--aligned]
[-d|--debug]
[-h|-?|--help]
[--ignorelockingfailure]
[--nameprefixes]
[--noheadings]
[--nosuffix]
[-o|--options [+]Field[,Field]]
[-O|--sort [+|-]key1[,[+|-]key2[,...]]]
[-P|--partial]
[--rows]
[--segments]
[--separator Separator]
[--trustcache]
[--unbuffered]
[--units hHbBsSkKmMgGtTpPeE]
[--unquoted]
[-v|--verbose]
[--version]
[PhysicalVolume [PhysicalVolume...]]
root@ubuntu:/home/zhangbin# pvs --a
pvs: option '--a' is ambiguous
Error during parsing of command line.
root@ubuntu:/home/zhangbin# pvs -a
PV VG Fmt Attr PSize PFree
/dev/ram0 -- 0 0
/dev/ram1 -- 0 0
/dev/ram10 -- 0 0
/dev/ram11 -- 0 0
/dev/ram12 -- 0 0
/dev/ram13 -- 0 0
/dev/ram14 -- 0 0
/dev/ram15 -- 0 0
/dev/ram2 -- 0 0
/dev/ram3 -- 0 0
/dev/ram4 -- 0 0
/dev/ram5 -- 0 0
/dev/ram6 -- 0 0
/dev/ram7 -- 0 0
/dev/ram8 -- 0 0
/dev/ram9 -- 0 0
/dev/root -- 0 0
/dev/sda3 -- 0 0
/dev/sda5 -- 0 0
root@ubuntu:/home/zhangbin#
lvm> vgdisplay VolGroup00
Volume group "VolGroup00" not found 没有这个组。
lvm> pvs
lvm> pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
lvm> pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 lvm2 -- 4.99g 4.99g
lvm>
lvm> vgextend VolGroup00 /dev/sda3
Volume group "VolGroup00" not found
lvm> vgextend VolGroup00 /dev/sda1
Volume group "VolGroup00" not found
lvm> pvcreate /dev/sda1
Can't open /dev/sda1 exclusively. Mounted filesystem?
lvm>
lvm> quit
Exiting.
root@ubuntu:/home/zhangbin# df -;
df: `-': No such file or directory
df: no file systems processed
root@ubuntu:/home/zhangbin# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 19737268 17853404 881268 96% /
none 250352 256 250096 1% /dev
none 254580 168 254412 1% /dev/shm
none 254580 112 254468 1% /var/run
none 254580 0 254580 0% /var/lock
none 254580 0 254580 0% /lib/init/rw
root@ubuntu:/home/zhangbin# fdisk -l
Disk /dev/sda: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00030124
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2497 20051968 83 Linux
/dev/sda2 2497 2611 916481 5 Extended
/dev/sda3 2612 3263 5237190 83 Linux
/dev/sda5 2497 2611 916480 82 Linux swap / Solaris
root@ubuntu:/home/zhangbin#
root@ubuntu:/home/zhangbin# vgdisplay VolGroup00
Volume group "VolGroup00" not found
vmware提供的磁盘管理工具。
其实用图形界面就行。
C:/Program Files/VMware/VMware Workstation>vmware-vdiskmanager
VMware Virtual Disk Manager - build 385536.
Usage: vmware-vdiskmanager.exe OPTIONS <disk-name> | <mount-point>
Offline disk manipulation utility
Operations, only one may be specified at a time:
-c : create disk. Additional creation options must
be specified. Only local virtual disks can be
created.
-d : defragment the specified virtual disk. Only
local virtual disks may be defragmented.
-k : shrink the specified virtual disk. Only local
virtual disks may be shrunk.
-n <source-disk> : rename the specified virtual disk; need to
specify destination disk-name. Only local virtual
disks may be renamed.
-p : prepare the mounted virtual disk specified by
the mount point for shrinking.
-r <source-disk> : convert the specified disk; need to specify
destination disk-type. For local destination disks
the disk type must be specified.
-x <new-capacity> : expand the disk to the specified capacity. Only
local virtual disks may be expanded.
-R : check a sparse virtual disk for consistency and atte
mpt
to repair any errors.
-D : make disk deletable. This should only be used on di
sks
that have been copied from another product.
Other Options:
-q : do not log messages
Additional options for create and convert:
-a <adapter> : (for use with -c only) adapter type
(ide, buslogic, lsilogic). Pass lsilogic for other a
dapter types.
-s <size> : capacity of the virtual disk
-t <disk-type> : disk type id
Options for remote disks:
-h <hostname> : hostname of remote server
-u <username> : username for remote server
-f <filename> : file containing password
-P <port> : optional TCP port number (default: 902)
-S : specifies that the source disk is remote, by default
the remote options are assumed to refer to the
destination.
Disk types:
0 : single growable virtual disk
1 : growable virtual disk split in 2GB files
2 : preallocated virtual disk
3 : preallocated virtual disk split in 2GB files
4 : preallocated ESX-type virtual disk
5 : compressed disk optimized for streaming
6 : thin provisioned virtual disk - ESX 3.x and above
The capacity can be specified in sectors, KB, MB or GB.
The acceptable ranges:
ide adapter : [1MB, 2040.0GB]
scsi adapter: [1MB, 2040.0GB]
ex 1: vmware-vdiskmanager.exe -c -s 850MB -a ide -t 0 myIdeDisk.vmdk
ex 2: vmware-vdiskmanager.exe -d myDisk.vmdk
ex 3: vmware-vdiskmanager.exe -r sourceDisk.vmdk -t 0 destinationDisk.vm
dk
ex 4: vmware-vdiskmanager.exe -x 36GB myDisk.vmdk
ex 5: vmware-vdiskmanager.exe -n sourceName.vmdk destinationName.vmdk
ex 6: vmware-vdiskmanager.exe -r sourceDisk.vmdk -t 4 -h esx-name.mycomp
any.com /
-u username -f passwordfile "[storage1]/path/to/targetDisk.vmdk"
ex 7: vmware-vdiskmanager.exe -k myDisk.vmdk
ex 8: vmware-vdiskmanager.exe -p <mount-point>
(A virtual disk first needs to be mounted at <mount-point>)
C:/Program Files/VMware/VMware Workstation>
===================================================================
disk utiltiy显示界面很大,而且固定,经常超过我800*600的显示区域,因此考虑换gparted。
gparted很牛的。但是调整/的大小,因为/不能被卸载,所以要考虑其他方案。
这位前辈,用gparted很好的解决了分区的问题。他采用的是iso启动的方案。写了一个手记。
http://hi.baidu.com/%CB%E9%C6%AC1987/blog/item/794af883cae5c4dc9023d945.html
====================================================
以下是我的过程:
iso和激活光驱。
这样就制定了光驱的iso文件。
采用但是gparted的live iso,很牛逼啊。都做成一个iso了。
开机在vmware白字黑屏幕哪里,按F2,启动bios,设置从光驱启动,但是一直都不行。
在ubuntu中,激活了一个下有效较的那个光盘icon,ubuntu10.04识别到了光驱内容,说明了两点:
1.需要点击光盘icon,激活vmware的光驱读取。
2.gparted的iso镜像是好的,用google chrome下载文件,达到了104KB/s左右,但是没有卡。
而用qq传递文件,还不到40KB/s,以及迅雷下载不论多小的文件,都会让网络变得很卡。
不知道问题出在什么地方。
==================================================================
激活了光驱之后。
启动gparted livecd
重启,就出来了gparted livecd 的界面,很炫。
还有很多小工具。
用gparted的默认设置启动:
首先要求设置keymap,键盘映射么?
直接按回车。
26是简体中文,默认是usa英文。
默认的0是x11界面。
看到这个界面,我陶醉了。
我删掉了swap 分区。
删掉了lvm分区。(之前在lvm里头,我把5G的分区,设置为lvm了。)
然后就等待合并了,否则/不能移动大小。
这是在ubunt10.04上gparted的: 逻辑卷不支持。
虚拟机默认的ubuntu系统用512M内存,swap就设置为256好了。
swap默认是作为主分区的。
我觉得都行吧。
boot还行也没有被我独立出来,而是在/中了。
分区后:
gparetd的live cd 是个很好的工具箱。
退出menu----shutdown了。
按回车,然后就显示 now halt。。。。。。。。。
看一下情况:
- vmware虚拟机调整ubuntu10.04分区大小
- VMware虚拟机中调整Linux分区大小
- VMware虚拟机中调整Linux分区大小
- ubuntu10.04 虚拟机再次扩充分区大小
- VMware虚拟机中调整Linux分区大小手记
- 调整VMware虚拟机硬盘容量大小
- 调整vmware虚拟机硬盘空间大小
- 调整VMware虚拟机硬盘容量大小
- 调整VMware虚拟机硬盘容量大小
- 【转】VMware虚拟机中调整Linux分区大小——使用GParted
- VMware虚拟机中调整Linux分区大小——使用GParted
- VMware虚拟机中调整Linux分区大小——使用GParted
- VMware虚拟机中调整Linux分区大小——使用GParted
- VMware虚拟机硬盘调整 + NTFS分区合并
- VMware虚拟机下调整ubuntu14.04界面大小
- VMware虚拟机屏幕大小(屏幕分辨率)调整
- VMware虚拟机屏幕大小(屏幕分辨率)调整
- 调整vmware linux虚拟机硬盘大小
- Fedora 和 Ubuntu 上的段错误
- Linux kernel Memory Barrier
- 经典的背景音乐
- VC6+WDK+DriverStudio编译Windows驱动程序环境搭建
- 关于数据库考试,想出来的BT题目
- vmware虚拟机调整ubuntu10.04分区大小
- Eclipse的查找功能及其他技巧
- vmware虚拟机上ubuntu操作系统安装arm-linux-gcc交叉编译环境
- SVN仓库备份脚本
- 早上百杰IT人生-演讲稿
- 用HibernateTemalate分页的注意事项
- Google和百度、雅虎的站内搜索代码
- WebGL学习01
- AnyCut | 创建桌面快捷方式 | PackageManager获得系统基本信息 | UserTask多线程