Clonezilla gives disk in use on restore ( sfdisk This dis is currently used )

0

I am trying to automate a clonezilla imaging, Thie issue is that the restore fails due to it saying that the device is in use

When I type "mount" /dev/sda is not anyware in the list ( and there mdadm is disabled as well and there is no /dev/md... in use )

If I manualy use fdisk to clear the partitions then run partprobe I get

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.

If I do reboot, after whiping the data the restore works.

My boot options on pxelinux.cfg/default are 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

the contents of /home/partimage/restoreGolden.sh is /usr/sbin/ocs-sr -hn1 OP --batch -g auto -e1 auto -e2 -r -j2 -p reboot restoredisk GoldenImage sda

Tim Holum

Posted 2015-02-04T20:54:43.043

Reputation: 163

I think I figured it out, nomdadm does not work on ubuntu based clonezilla, And I switched from debian to ubuntu, ( /dev/md127 was showing up ) I am going to add mdadm --stop /dev/md127 to my startup script to see if it fixes it – Tim Holum – 2015-02-04T21:02:39.637

Answers

0

I resolved the main issue by editing clonezilla to disable 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

Tim Holum

Posted 2015-02-04T20:54:43.043

Reputation: 163