我正在尝试自动执行 clonezilla 映像,问题是恢复失败,因为它说该设备正在使用中
当我输入“mount”时,/dev/sda 不在列表中(并且 mdadm 也被禁用,并且没有 /dev/md... 在使用中)
如果我手动使用 fdisk 清除分区然后运行 partprobe 我会得到
Error: Partition(s) 2 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.
如果我重新启动,在清除数据后恢复就可以成功。
我在 pxelinux.cfg/default 上的启动选项是
LABEL Factory Reset KERNEL clonezilla/vmlinuz APPEND initrd=clonezilla/initrd.img username=user boot=live union=aufs noswap noprompt vga=788 keyboard-layouts=NONE locales=en_US.UTF-8 fetch=tftp://10.11.12.1/clonezilla/filesystem.squashfs config quiet ocs_live_run="/home/partimag/restoreGolden.sh" ocs_live_extra_param="" ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_US.UTF-8 ocs_prerun="mount -t nfs 10.11.12.1:/copos/SystemImages /home/partimag && /home/partimage/fdisk.sh" nomdadm nodmraid noswap
/home/partimage/restoreGolden.sh 的内容是
/usr/sbin/ocs-sr -hn1 OP --batch -g auto -e1 auto -e2 -r -j2 -p reboot restoredisk GoldenImage sda
答案1
我通过编辑 clonezilla 来禁用 mdadm 解决了主要问题
mkdir /tmp/sqash cp /path/to/filesystem.squashfs /tmp/sqash apt-get install squashfs-tools cd /tmp/squash unsquashfs filesystem.squashfs rm filesystem.squashfs echo "blacklist md_mod" >> squashfs-root/etc/modprobe.d/ocs-live-blacklist.conf echo "blacklist raid1" >> squashfs-root/etc/modprobe.d/ocs-live-blacklist.conf mksquashfs squashfs-root filesystem.squashfs -b 1024k -comp xz -Xbcj x86 -e boot