首页 抖音热门文章正文

将 windows 系统通过 dd 重装成 linux debian 系统

抖音热门 2025年02月16日 05:01 4 admin

在网上,有好多能把 Linux 系统重装成 Windows 系统的脚本。但是呢,能把 Windows 系统重装成 Linux 系统的脚本特别少。萌咖的 dd 脚本,因为它所在的服务器停用了,相关资源也获取不到,所以现在没法用了。要是你正好有那几个配置文件的话,还是可以用萌咖的脚本进行操作的。

  • g2ldr - 无法获取
  • g2ldr.mbr - 无法获取
  • grub.cfg - 无法获取
  • vmlinuz
  • initrd.img

否则就会提示 Check g2ldr SHA1 FAIL

还有一种方法就是通过 powershell 或 cmd 来安装 cygwin 环境来实现 dd,这个方法我安装过程中不仅频繁被杀软拦截,其次很多资源也是无法下载。最终放弃。

EasyBCD+mfslinux

最终我将采用另外一种便捷的方式重装 dd,通过 EasyBCD 引导 mfslinux,然后在这个临时的 linux 镜像中,通过 dd 命令将硬盘写为官方版本的 debian

下载安装

https://sm.myapp.com/original/System/EasyBCD_v2.3.exe
https://mfsbsd.vx.sk/files/iso/mfslinux/mfslinux-0.1.10-f9c75a4.iso

安装 EasyBCD 并添加 mfslinux 启动菜单并设置为默认选项

将 windows 系统通过 dd 重装成 linux debian 系统

将 windows 系统通过 dd 重装成 linux debian 系统

直接重启系统,就会默认进入 mfslinux 系统

将 windows 系统通过 dd 重装成 linux debian 系统

通过 ssh 连接

此时如果你是 dhcp 默认获取的 IP,就可以直接通过 ssh 连接。

username: root
password: mfsroot

开始 dd Debian

可选安装

opkg update && opkg install pv

dd 无进度

wget -O- "https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-nocloud-amd64.raw" | dd of=/dev/vda

dd 带进度

wget -O- "https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-nocloud-amd64.raw" | pv | dd of=/dev/vda

修复分区表

当你尝试挂载 dd 之后的系统时,可能会报错;使用 fdisk 查看分区,发现磁盘大小不一致,直接保存最新配置就好。

root@mfslinux:~# fdisk -lGPT PMBR size mismatch (4194303 != 125829119) will be corrected by write.The backup GPT table is not on the end of the device.Disk /dev/vda: 60 GiB, 64424509440 bytes, 125829120 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: gptDisk identifier: ECC0605C-D5AA-C740-A12B-EF3D2DB274F1Device      Start     End Sectors  Size Type/dev/vda1  262144 4192255 3930112  1.9G Linux root (x86-64)/dev/vda14   2048    8191    6144    3M BIOS boot/dev/vda15   8192  262143  253952  124M EFI SystemPartition table entries are not in disk order.

使用 fdisk /dev/sda 输入 w 就好了

root@mfslinux:~# fdisk /dev/vdaWelcome to fdisk (util-linux 2.36.1).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.GPT PMBR size mismatch (4194303 != 125829119) will be corrected by write.The backup GPT table is not on the end of the device. This problem will be corrected by write.Command (m for help): wThe partition table has been altered.Calling ioctl() to re-read partition table.Syncing disks.

尝试挂载分区

root@mfslinux:~# mkdir /mnt/vda1root@mfslinux:~# mount /dev/vda1 /mnt/vda1NTFS signature is missing.Failed to mount '/dev/vda1': Invalid argumentThe device '/dev/vda1' doesn't seem to have a valid NTFS.Maybe the wrong device is used? Or the whole disk instead of apartition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

报错了不要紧,可以先检查下有没有挂载成功,一般会挂载成功,但会存在一个警告。

通过 ls /mnt/vda1 检查有没有系统文件。

root@mfslinux:~# ls /mnt/vda1bin         dev         home        lib64       media       opt         root        sbin        sys         usrboot        etc         lib         lost+found  mnt         proc        run         srv         tmp         var

一般是文件系统格式没有检查正确,可以卸载重新挂载

umount /mnt/vda1mount -t ext4 /dev/vda1 /mnt/vda1

配置远程 ssh

此时没有问题了,但按照教程来说应该配置 ssh 配置以及设置 root,但是会发现系统目录下根本没有 ssh 目录,很多基础命令也都不存在。

挂载出来的系统看不到 ssh 目录和配置

root@mfslinux:~# ls /mnt/vda1/etc/ss*certs        openssl.cnf  private

可能是因为系统比较原生精简什么都没有。此时可以直接重启系统。开机直接使用 root 登录,没有密码。前提是你有 vnc 控制面板,否则会登录不进去系统。

reboot

开机后检查网络有没有问题,配置下基础的环境依赖包。

apt updateapt install -y vim openssh-server fdisk

通过 vi 编辑 sshd 配置文件,主要修改内容:

Port 22ListenAddress 0.0.0.0PermitRootLogin yesPasswordAuthentication yes

其他内容保持不变。

修改 root 密码

passwd

重启 sshd 服务,即可远程 ssh 登录了。

service sshd restart

参考链接

https://hostloc.com/thread-1013266-1-1.html

https://ayw.ink/2565.html

发表评论

泰日号Copyright Your WebSite.Some Rights Reserved. 网站地图 备案号:川ICP备66666666号 Z-BlogPHP强力驱动