raw 镜像转换至 vhdx
linux – How do I convert an .img file to vhd? – Super User
直接简单粗暴扔给 qemu-utils 处理就可以了。
qemu-img convert ./debian-12-nocloud-amd64-20250428-2096.raw -O vhdx ./debian-12-nocloud-amd64-20250428-2096.vhdx
可以添加 -o subformat=fixed
或 -o subformat=dynamic
来配置目标 vhdx 是否为动态大小。
创建类似 VMware 中 NAT 类型的虚拟交换机
Set up a NAT network | Microsoft Learn
Get-NetNat (NetNat) | Microsoft Learn
Hyper-V NAT 网络设置固定 IP / DHCP – wswind – 博客园
创建虚拟网卡和配置其静态 IP 可以在可视化界面中完成,也可以用 PowerShell:
New-VMSwitch -SwitchName "SwitchName" -SwitchType Internal
PS C:\> Get-NetAdapter
Name InterfaceDescription ifIndex Status MacAddress LinkSpeed
---- -------------------- ------- ------ ---------- ---------
vEthernet (intSwitch) Hyper-V Virtual Ethernet Adapter 24 Up 00-15-5D-00-6A-01 10 Gbps
Wi-Fi Marvell AVASTAR Wireless-AC Net... 18 Up 98-5F-D3-34-0C-D3 300 Mbps
Bluetooth Network ... Bluetooth Device ... 21 Disconnected 98-5F-D3-34-0C-D4 3 Mbps
New-NetIPAddress -IPAddress <NAT Gateway IP> -PrefixLength <NAT Subnet Prefix Length> -InterfaceIndex <ifIndex>
创建 NAT,没找到对应的可视化工具。
New-NetNat -Name <NATOutsideName> -InternalIPInterfaceAddressPrefix <NAT subnet prefix>
创建 DNAT 规则:
Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/0" -ExternalPort 6881 -Protocol TCP -InternalIPAddress "192.168.1.100" -InternalPort 6881 -NatName Default
启用 CIFS/SMB 在 Linux 中挂载
samba – How do I mount a CIFS share via FSTAB and give full RW to Guest – Ask Ubuntu
How to mount a windows/samba windows share under Linux? – Unix & Linux Stack Exchange
安装依赖,然后挂载测试:
apt install cifs-utils
mount -t cifs -o "username=debian" -o "password=password" //192.168.1.1/assets /mnt/assets
确认无误后写入 /etc/fstab
:
//192.168.1.1/assets /mnt/assets cifs username=username,password=password,uid=1000,gid=1000 0 0
别忘了验证,防止影响操作系统启动:
umount /mnt/assets
systemctl daemon-reload
mount -a
发表回复