vm_box.webp
1. 以 管理员身份 打开命令提示符 CMD 查看一下U盘的 DeviceID【磁盘标识盘】:
wmic diskdrive list brief
usb-vmdk.png
2. 使用 VBoxManage 命令生成vmdk文件 usb.vmdk
cd "C:Program FilesOracleVirtualBox"
VBoxManage.exe internalcommands createrawvmdk -filename "C:VPCusb.vmdk" -rawdisk \.PhysicalDrive3
# RAW host disk access VMDK file C:VPCusb.vmdk created successfully.
""""""
## 3. "usb.vmdk" 其实只是个链接文件,记录了U盘的信息
Disk DescriptorFile
version=1
CID=a59fa381
parentCID=ffffffff
createType=fullDevice
Extent description
RW 30941184 FLAT \.PHYSICALDRIVE3
0
The disk Data Base
DDB
ddb.virtualHWVersion = 4
ddb.adapterType=ide
ddb.geometry.cylinders=16383
ddb.geometry.heads=16
ddb.geometry.sectors=63
ddb.uuid.image=080cc370-84e5-403b-a815-1edc877ca92d
ddb.uuid.parent=00000000-0000-0000-0000-000000000000
ddb.uuid.modification=00000000-0000-0000-0000-000000000000
ddb.uuid.parentmodification=00000000-0000-0000-0000-000000000000
## 4. 启动 "VirtualBox" 挂载U盘 "usb.vmdk"
![usb.png][3]
## 5. "VirtualBox" 网络设置
![net.png][4]
ip addr # 查看网络,如果桥接网卡,IP 就和宿主机同网段;如果NAT就要设置端口转发
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:d6:7f:57 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
- 端口转发如图设置,把宿主机的端口2222 转发到NAT虚拟机 10.0.2.15:22 端口
## 6. ssh 软件登陆,和 "partx" 查看分区
- "/dev/sda"虚拟机硬盘 ; "/dev/sdb" 挂载的硬盘
$ ssh -p 2222 [email protected]
$ partx /dev/sda
NR START END SECTORS SIZE NAME UUID
1 2048 14776319 14774272 7G 9c5e17ee-01
2 14778366 16775167 1996802 975M 9c5e17ee-02
5 14778368 16775167 1996800 975M 9c5e17ee-05
$ partx /dev/sdb
NR START END SECTORS SIZE NAME UUID
4 256 30941183 30940928 14.8G cad4ebea-04
## dd 命令是备份Linux系统,或者是linux系统杀手
- dd指令 语法格式
dd [option] if=file:输入文件名,缺省为标准输入 of=file:输出文件名,缺省为标准输出
测试纯写入性能
dd if=/dev/zero of=test bs=8k count=10000 oflag=direct
测试纯读取性能
dd if=test of=/dev/null bs=8k count=10000 iflag=direct
## 7. 把虚拟机linux系统 DD到U盘
![111.png][5]
dd if=/dev/sda of=/dev/sdb bs=8k count=10000
partx /dev/sdb # 先DD硬盘分区表80M,在U盘上建立分区 /dev/sdb1
# 再只对 /dev/sda1 系统分区DD到U盘 /dev/sdb1 分区
dd if=/dev/sda1 of=/dev/sdb1
[1]: https://lyvba.com/wp-content/uploads/2021/10/1296965730.webp
[2]: https://lyvba.com/wp-content/uploads/2021/10/2415034998.png
[3]: https://lyvba.com/wp-content/uploads/2021/10/3507041567.png
[4]: https://lyvba.com/wp-content/uploads/2021/10/2960821495.png
0 条评论