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 ...
随机推荐
- HTML(四):行级标签和块级标签
一.行级标签 行级标签又称为内联标签,行级标签不会单独占据一行,设置宽高无效,行内内部可以容纳其他行内元素,但不可以容纳块元素,不然会出现无法预知的效果. 常见行级标签: span.strong.em ...
- 如何通过使用窗体身份验证和 Visual C#.NET 对 Active Directory 验证身份
本分步指南演示如何在 ASP.NET 应用程序如何使用窗体身份验证允许用户使用轻型目录访问协议 (LDAP),对 Active Directory 进行验证.经过身份验证的用户重定向之后,可以使用Ap ...
- FreeRDP的安装配置(错误信息:SSL_read: Failure in SSL library (protocol error?))
最新文章:Virson's Blog 使用xfreerdp [serveripaddress]命令,连接xp/windows 2003都正常,但是在连接win7/2008时总是出错: ;------- ...
- JAVA内部线程2
GC Daemon JVM GC Daemon线程是JVM为RMI提供远程分布式GC使用的,GC Daemon线程里面会主动调用System.gc()方法,对服务器进行Full GC. 其初衷是当RM ...
- kali 安装KVM教程---》给自己的笔记
⦁ 查看系统环境支持 egrep 'svm|vmx' /proc/cpuinfo 如果不支持则是 没有任何输出如果支持有类似下面的输出: ⦁ 安装软件 sudo apt-get install kvm ...
- WM_CONCAT字符超过4000的处理办法
参考网址: http://stackoverflow.com/questions/11541383/ordering-by-list-of-strings-in-oracle-sql-without- ...
- 【转】【Android】Android Drawable Shape 组合画田字格
使用layer-list组合多个Shap <?xml version="1.0" encoding="utf-8"?> <layer-list ...
- Java如何处理异常方法?
在Java编程中,如何处理异常方法? 本例展示了如何使用System类的System.err.println()方法处理异常方法. package com.yiibai; public class E ...
- resharper安装后,F12不能转到定义,也不是反编译,而是转到对象浏览器(object browser)
问: resharper安装后,一不小心点错了(选择了object browser)以上配置在哪里设置?转到定义用习惯了. 回答 :打开Resharper,选择Options,然后选择Tools中的E ...
- MySQL binlog日志操作详解
MySQL的二进制日志可以说是MySQL最重要的日志了,它记录了所有的DDL和DML(除了数据查询语句)语句,以事件形式记录,还包含语句所执行的消耗的时间,MySQL的二进制日志是事务安全型的. bi ...