Extended VM Disk In VirtualBox or VMware (虚拟机磁盘扩容)
First, Clean VM all snapshot, and poweroff your VM.
vmdk:
vmware-vdiskmanager -x 16GB myDisk.vmdk
vdi:
VBoxManage modifyhd <absolute path to file> --resize <size in MB>
And now, go to guest OS to resize partition.
I have only one partition, and it's root partition. You can use LiveCD do this. However, You alse use fdisk and resize2fs, that support online mode.
fdisk /dev/sda
Delete old partition, and create new partition you want. Last, write to disk, reboot your VM. Then run:
resize2fs /dev/sda1
Now, you can check your partition size.
df -h
P.S.
I find Shell script on raspi-config. It's a script it is used for expand root filesystem on SD card.
#.......
do_expand_rootfs() {
if ! [ -h /dev/root ]; then
whiptail --msgbox "/dev/root does not exist or is not a symlink. Don't know how to expand"
return
fi ROOT_PART=$(readlink /dev/root)
PART_NUM=${ROOT_PART#mmcblk0p}
if [ "$PART_NUM" = "$ROOT_PART" ]; then
whiptail --msgbox "/dev/root is not an SD card. Don't know how to expand"
return
fi # NOTE: the NOOBS partition layout confuses parted. For now, let's only
# agree to work with a sufficiently simple partition layout
if [ "$PART_NUM" -ne ]; then
whiptail --msgbox "Your partition layout is not currently supported by this tool. You are probably using NOOBS, in which case your root filesystem is already expanded anyway."
return
fi LAST_PART_NUM=$(parted /dev/mmcblk0 -ms unit s p | tail -n | cut -f -d:) if [ "$LAST_PART_NUM" != "$PART_NUM" ]; then
whiptail --msgbox "/dev/root is not the last partition. Don't know how to expand"
return
fi # Get the starting offset of the root partition
PART_START=$(parted /dev/mmcblk0 -ms unit s p | grep "^${PART_NUM}" | cut -f -d:)
[ "$PART_START" ] || return
# Return value will likely be error for fdisk as it fails to reload the
# partition table because the root fs is mounted
fdisk /dev/mmcblk0 <<EOF
p
d
$PART_NUM
n
p
$PART_NUM
$PART_START p
w
EOF
ASK_TO_REBOOT= # now set up an init.d script
cat <<\EOF > /etc/init.d/resize2fs_once &&
#!/bin/sh
### BEGIN INIT INFO
# Provides: resize2fs_once
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Resize the root filesystem to fill partition
# Description:
### END INIT INFO . /lib/lsb/init-functions case "$1" in
start)
log_daemon_msg "Starting resize2fs_once" &&
resize2fs /dev/root &&
rm /etc/init.d/resize2fs_once &&
update-rc.d resize2fs_once remove &&
log_end_msg $?
;;
*)
echo "Usage: $0 start" >&
exit
;;
esac
EOF
chmod +x /etc/init.d/resize2fs_once &&
update-rc.d resize2fs_once defaults &&
if [ "$INTERACTIVE" = True ]; then
whiptail --msgbox "Root partition has been resized.\nThe filesystem will be enlarged upon the next reboot"
fi
}
#......
[via]
[via]
Extended VM Disk In VirtualBox or VMware (虚拟机磁盘扩容)的更多相关文章
- Hyper-V与VirtualBox或VMware虚拟机软件冲突的解决方法(VirtualBox只能创建32位虚拟机)
Hyper-V与VirtualBox或VMware虚拟机软件冲突的解决方法 Hyper-V是微软的虚拟化软件,功能类似VirtualBox.VMware,可以用来创建虚拟机. 虚拟化软件都是基于CPU ...
- 如何将Virtualbox和VMware虚拟机相互转换[译文211] - 转
迁移到其他的虚拟机程序可行会吓倒一批人.如果你已经按照自己的喜好设置好了虚拟机,那么就不需要再从头安装——你可以迁移现有的虚拟机. VirtualBox 和 VMware 使用不同的虚拟机格式,不过他 ...
- Workstation和Virtualbox的虚拟机磁盘扩容方式.
1. 虚拟机磁盘管理, 更改磁盘格式是一个场景 还有一个场景是 硬盘空间不够了 需要扩充. 方法主要有两个. 如果是workstation的的虚拟机. 并且没有快照 可以直接GUI操作 如下图: 虚拟 ...
- 关于VMware虚拟机磁盘收缩的几种方法
VMware虚拟机在使用过程中,随着软件和数据的增多,虚拟磁盘占用的硬盘空间会逐渐增大,但删除数据后,却不会自动减小占用的物理硬盘空间 而是继续占用相应大小.如果需要解决上面的问题,就需要收缩wmwa ...
- VMware exsi虚拟机磁盘扩容
创建Linux时分配磁盘空间随着使用的增加,使用率逐渐升高,需要对/root进行扩容,此时需要在添加或者扩展一下磁盘. 查看Linux版本信息 [root@localhost ~]# cat /etc ...
- VMware虚拟机磁盘收缩的几种方法
原文地址:http://www.cnblogs.com/5201351/p/4290401.html 根据下面转载的内容,我在VMware 12.0.0 build-2985596的ubuntu上做试 ...
- [CentOS7]Windows下VirtualBox虚拟机磁盘扩容
目录 虚拟系统磁盘文件扩充 修改分区 LVM更新 扩容文件系统 参考资料 虚拟系统磁盘文件扩充 命令操作 命令行运行VBoxManage,modifyhd扩容需要文件格式为.vdi,如为.vmdk,需 ...
- Vmware Linux虚拟机磁盘扩容方法
我的LINUX版本是ubuntu12.04 32bit.今天在下载android源代码的时候发现自己最初给这个虚拟机分配的磁盘空间不足了(只有20G).所以就需要给磁盘扩容.网上大致搜索了一下,主要有 ...
- 最简单的Linux虚拟机磁盘扩容方法
思路:1.虚拟机增加磁盘容量: 2.将增加的磁盘容量增加到系统分区中: 准备阶段: 下载Gparted软件:https://sourceforge.net/projects/gparted/files ...
随机推荐
- ubuntu14.04 64位JDK安装
1 官网下载jdk http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html jdk-8u ...
- MPAndroidChart的具体属性方法
android中常用的第三方图表MPAndroidChart的一些具体属性及方法说明 注意:在将折线图转为曲线图时,lineDataSet.setMode(LineDataSet.Mode.CUBIC ...
- 自然语言交流系统 phxnet团队 创新实训 项目博客 (三)
语音转文本部分是调用的科大讯飞的在线语音,它的激发方式是按键,通过按钮触发开启安卓设备的录音,此部分需要在源码中写入关于安卓权限的要求,来调用安卓的录音权限,当按钮被激发,则开始进入语音录制阶段,将麦 ...
- Axiom3D:资源引用与加载基本流程.
Archive:对应文件夹位置,包含文件夹,压缩文件,网络位置,包含Load,Unload,Open,Create,Remove,FineFile等主要虚方法,用于对应各具体Archive来实现. R ...
- OpenGL透明与混色效果
一.理论讲解 在OpenGL中,物体透明技术通常被叫做混合(Blending). 透明是物体(或物体的一部分)非纯色而是混合色,这种颜色来自于不同浓度的自身颜色和它后面的物体颜色. 一个有色玻璃窗就是 ...
- linux中CURL的安装(转)
转自(http://blog.csdn.net/makenothing/article/details/39250491) curl是一款著名的字符界面下的下载工具,支持HTTP.HTTPS.FTP. ...
- 我的openwrt开发相关文章
openwrt学习笔记: 在openwrt的学习过程中,走了非常多的弯路.一直以来有个期盼.希望能够出个简易教程,希望openwrt的同仁们能够更加高速的入手. . openwrt学习笔记(三十二): ...
- 微软office web apps 服务器搭建之在线文档预览
案例:http://owa.linbsoft.com/op/generate.aspx# 文档地址:http://demo.linbsoft.com/CourseFile/201407/2014070 ...
- Linux 定时任务crontab_014
1. crontab命令概念 crontab命令用于设置周期性被执行的指令.该命令从标准输入设备读取指令,并将其存放于“crontab”文件中,以供之后读取和执行. cron 系统调度进程. 可以使 ...
- C# 反射(GetType) 获取动态Json对象属性值的方法
之前在开发一个程序,希望能够通过属性名称读取出属性值,但是由于那时候不熟悉反射,所以并没有找到合适的方法,做了不少的重复性工作啊! 然后今天我再上网找了找,被我找到了,跟大家分享一下. 其实原理并不复 ...