====== 用 alpinelinux 作为livecd OS完成dd硬盘数据复制 ====== 环境:debian 9 64位,alpinelinux 3.8 过程: 1.mkdir /liveos # 创建 /liveos 目录 2.mount -t tmpfs tmpfs /liveos # 设置 /liveos 为 tmpfs 类型 3.cd /liveos # 切换到 /liveos 目录 4.wget -O- http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/x86_64/alpine-minirootfs-3.8.0-x86_64.tar.gz|gzip -dc|tar xv # 下载 aplinelinux 文件包,解压 {{https://alioss.anqun.org/typecho/2018/09/25/063452277056688.png}} 5.cp /etc/resolv.conf etc # 复制nameserver配置文件,这样可以以域名访问外网 6.mount --bind /dev /liveos/dev # 挂载 /liveos/dev,dd硬盘数据复制对象 7.mount --bind /dev/pts /liveos/dev/pts # 挂载 /liveos/dev/pts 8.mount --bind /proc /liveos/proc # 挂载 /liveos/proc 9.chroot . /bin/ash # chroot 到当前目录 10.wget -O- http://file.gz | gunzip | dd of=/dev/sda # 下载dd包,复制到sda硬盘 11.reboot -f # 重启 {{https://alioss.anqun.org/typecho/2018/09/25/063452182110148.png}} 12.数据复制有效 {{https://alioss.anqun.org/typecho/2018/09/25/063463043126620.png}} 参考: * https://wiki.alpinelinux.org/wiki/Installing_Alpine_Linux_in_a_chroot * https://github.com/marcan/takeover.sh/issues/5 * https://wiki.debian.org/chroot