嵌入式开发:在虚拟机中为操作系统…

本文详细介绍了如何在VMware虚拟机中增加硬盘空间,包括设置新增硬盘、分区、格式化、挂载及系统注册步骤,并提供了卸载硬盘的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

由于自己的虚拟机的硬盘空间较小,就将自己的实战写下来:

1退出LINUX 系统,在vmware 启动界面中选择VM 菜单下的Settings 来增加磁盘,然后选择add,选择hard disk,点击Next。

 

 

2)选中create new virtual disk,点击下一步,选择scsi,继续下一步。选择好你要新增磁盘的大小,勾选Allocate all disk space now 立即分配空间,下一步,在你的硬盘上选择一个目录来创建,点击完成结束。

 

 

3)给刚创建的硬盘起个名字,它会默认放置在虚拟机所在的位置,此时可以到虚拟机所在的目录下查看分好的硬盘了

 

4)进入Linux 系统,使用sudo  fdisk -l  ( 该处不用sudo是没法用的),但是最后一行的含义是:sdb没有可用的分区

 

5)对创建的硬盘进行分区

在终端输入:sudo fdisk /dev/sdb

之后键入:m,可以看到帮助信息

键入:n,添加新分区

键入:p,选择添加主分区

键入:1,选择主分区号为1,这样创建后的主分区为sdb1

之后,fdsik 会让你选择该分区的开始值和结束值,直接回车

最后键入:w,保存所有并退出,完成新硬盘的分区

6)格式化磁盘

在终端输入:sudo mkfs -t ext4 /dev/sdb1

 

7.在用户主目录下新建一个文件, 如/home/wxm/newdisk。以后就把新增

的分区mount 到这个目录下。

 

注:mount 的用法 mount  设备    挂载点

执行:sudo mount -t ext4 /dev/sdb1  /home/wxm/newdisk/

 

8.在系统中注册刚创建的硬盘:

sudo vi /etc/fdtab

在该文件的末尾增加:(注意字母间的空间)

/dev/sdb1 /home/linux/newdisk ext4  defaults   0

 

9.到此时就可以看到刚创建的1G硬盘:也就可以直接使用/home/wxm/newdisk这段空间了。

df -h 查看系统中硬盘的信息


 

注:为了便于使用可以改变/home/wxm/newdisk的权限:

sudo chmod 777 /home/wxm/newdisk


 

 

卸载某块硬盘的方法:

1)sudo umount /home/wxm/newdisk

此时再使用df 就不会显示之前分配的硬盘空间了,但是:

当使用umount 命令后当重新启动系统的时候会出现提示某些硬盘没有挂载的信息,此时按shift+s 进入系统(原因是还没有在系统中将该段空间注销掉)

2)在系统中注销该段硬盘的:

sudo vi /etc/fstab

在该文件的末尾删除之前添加的注册信息,这样重新启动系统的时候会正常启动了。

/dev/sdb1 /home/linux/newdisk ext4  defaults   0

3)在虚拟机的配置界面将创建的硬盘删除:

4)将系统安装目录下的两个文件删除


 

总结:增加硬盘空间和卸载硬盘空间是个相反的过程。

 

 

CarpVM 是一个用 C 语言编写的小型虚拟机。可以嵌入在应用程序中使用。 包含的指令集有: HALT (code): Halts and attempts to clean up stack, data memory, and label memory before exiting with given exit code. NOP (): Does nothing. Seriously. LOAD (reg, val): Loads given integer value into given register. MOV (dst, src): Copies contents of src register into dst register. ADD (): Pops the top two integers from the stack and pushes their sum. SUB (): Pops the top two integers from the stack and pushes the difference (lower minus upper). MUL (): Pops the top two integers from the stack and pushes their product. MOD (rega, regb): Computes rega % regb and stores in ERX. NOT (reg): Computes bitwise NOT of reg and stores in reg. XOR (): Pops the top two integers from the stack and XORs them. OR (): Pops the top two integers from the stack and ORs them. AND (): Pops the top two integers from the stack and ANDs them. INCR (reg): Increments value in given register. DECR (reg): Decrements value in given register. INC (): Increments the value at the top of the stack. DEC (): Decrements the value at the top of the stack. PUSHR (reg): Pushes value in given register. PUSH (val): Pushes given value. POP (val): Pops an integer from the stack and dumps it into GBG. CMP (): Pops the top two integers from the stack and checks if equal. 0 means equal. Result will be pushed onto the stack. MOV (rega, regb): Move value in rega to regb. JZ (addr): Jumps to given absolute address if top of the stack is 0. RJZ (diff): Adds differential to current EIP (relative jump) if top of the stack is 0. JNZ (addr): Jumps to given absolute address if top of the stack is not 0. RJNZ (diff): Adds differential to current EIP (relative jump) if top of the stack is not 0. JMP (addr): Jumps to given absolute address. RJMP (diff): Adds differential to current EIP (relative jump). DBS (key, val): Sets data memory at key (string pointer) to given value. DBG (key, reg): Gets value from data memory at key (string pointer) and dumps it into given register. CALL (key, nargs): Save state and set EIP to value in data memory at key. RET (val): Push return value and load state. PREG (reg): Prints contents of given register. PTOP (): Peeks top of stack and prints top value. 标签:CarpVM
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值