Integrating clonezilla into grub

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
yamahama
Level 1
Level 1
Posts: 14
Joined: Mon Nov 06, 2017 7:08 am

Integrating clonezilla into grub

Postby yamahama » Mon Nov 06, 2017 7:36 am

I'm trying to integrate clonezilla into grub for easy one key unattended backups/restores. The best info i could find on doing this is this guide but unfortunately it does not work as it may be outdated. Some guidance would be appreciated (i'm a noob so please be gentle!).

If i enter the menu entries in the guide as is, i get an error that goes something like "iso file not found...you have to mount the kernel first." (The filename and path are correct). I've managed to get clonezilla live working manually by changing the corresponding menu entry (in /etc/grub.d/40_custom)

Code: Select all

menuentry "Clonezilla Live 2.5.2-31" {
set isofile="/isos/clonezilla-live-2.5.2-31-amd64.iso"
loopback loop (hd1,1)$isofile
linux (loop)/live/vmlinuz boot=live live-config noswap nolocales edd=on nomodeset ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\" keyboard-layouts=\"\" ocs_live_batch=\"no\" locales=\"\" vga=788 ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile
initrd (loop)/live/initrd.img
}

to this format (found elsewhere on the web):

Code: Select all

menuentry "Clonezilla Live 2.5.2-31" {
set isofile="/isos/clonezilla-live-2.5.2-31-amd64.iso"
loopback loop (hd1,1)$isofile
linux (loop)/live/vmlinuz boot=live components config findiso=$isofile ip=frommedia toram=filesystem.squashfs union=overlay username=user
initrd (loop)/live/initrd.img
}

unfortunately i'm not sure how i'd apply this to the automated backup and restore menu entries found in the original guide:

Code: Select all

menuentry "Clonezilla Live 2.5.2-31 (Unattended Backup)" {
set isofile="/isos/clonezilla-live-2.5.2-31-amd64.iso"
loopback loop (hd1,1)$isofile
linux (loop)/live/vmlinuz boot=live live-config noswap nolocales edd=on nomodeset ocs_prerun=\"mount /dev/sdb1 /mnt\" ocs_prerun1=\"mount --bind /mnt/backup /home/partimag/\" ocs_live_run=\"ocs-sr -q2 --batch -j2 -z1p -i 2000 -sc -p reboot savedisk autoproductname sda\" ocs_live_extra_param=\"\" keyboard-layouts=\"\" ocs_live_batch=\"yes\" locales=\"\" vga=788 ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile
initrd (loop)/live/initrd.img
}

menuentry "Clonezilla Live 2.5.2-31 (Unattended Restore)" {
set isofile="/isos/clonezilla-live-2.5.2-31-amd64.iso"
loopback loop (hd1,1)$isofile
linux (loop)/live/vmlinuz boot=live live-config noswap nolocales edd=on nomodeset ocs_prerun=\"mount /dev/sdb1 /mnt\" ocs_prerun1=\"mount --bind /mnt/backup /home/partimag/\" ocs_live_run=\"ocs-sr -g auto -e1 auto -e2 -r -j2 -p reboot restoredisk autoproductname sda\" ocs_live_extra_param=\"\" keyboard-layouts=\"\" ocs_live_batch=\"yes\" locales=\"\" vga=788 ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile
initrd (loop)/live/initrd.img
}


how do i do this right?

edit: I'm running a fresh install of 18.2 Cinnamon x64 (dual booting win 7). and the exact error message is as follow:

Code: Select all

error: file '/isos/clonezilla-live-2.5.2-31-amd64.iso' not found.
error: disk 'loop' not found.
error: you need to load the kernel first.

User avatar
pbear
Level 4
Level 4
Posts: 240
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Integrating clonezilla into grub

Postby pbear » Tue Nov 07, 2017 12:55 pm

Have to say, I don't see the point. If you want continuous backups of the whole system, you'd be much better off using rsync. That's one of the things it's designed for. Can't help you set it up, as I settled on a different backup strategy, but there are plenty of tutorials online.
Time flies like an arrow. Fruit flies like a banana.
Running Mint 18.2 Mate 64 bit

User avatar
JoeFootball
Level 6
Level 6
Posts: 1081
Joined: Tue Nov 24, 2009 1:52 pm
Location: /home/usa/mn/minneapolis/joe

Re: Integrating clonezilla into grub

Postby JoeFootball » Tue Nov 07, 2017 1:35 pm

yamahama wrote:error: file '/isos/clonezilla-live-2.5.2-31-amd64.iso' not found.
error: disk 'loop' not found.

To me it sounds like your GRUB option isn't pointed to the correct location. For example, the blog entry leverages (hd0,1) where you have (hd1,1). Also note that the blog script forces the skip of the image verification, and then reboots the system.

That said, while it's certainly an interesting project, make that this is the proper backup solution for you. I'm a huge fan of Clonezilla Live for making bare metal images of my hard drive, so I support your intentions.

But speaking for myself, I like the reassurance of the image verification, and seeing the result of the backup session before rebooting. I'd be skeptical that the above option would help me sleep better at night.

Joe

yamahama
Level 1
Level 1
Posts: 14
Joined: Mon Nov 06, 2017 7:08 am

Re: Integrating clonezilla into grub

Postby yamahama » Tue Nov 07, 2017 3:31 pm

JoeFootball wrote:
yamahama wrote:error: file '/isos/clonezilla-live-2.5.2-31-amd64.iso' not found.
error: disk 'loop' not found.

To me it sounds like your GRUB option isn't pointed to the correct location. For example, the blog entry leverages (hd0,1) where you have (hd1,1). Also note that the blog script forces the skip of the image verification, and then reboots the system.


Hi Joe,

Thanks for the reply. indeed it was an incorrect location issue even though i triple checked but i'd forgotten how sensitive linux is to case.

But then it'd fail with an error that went something like "aufs mount failed" which was fixed by adding an option union=overlay. i'll write up updated instructions here in case someone finds it useful.

yeah i love taking the time for that extra verification step too. but honestly i've NEVER seen clonezilla fail and speed is essential here considering how often i intend to use it.

User avatar
JoeFootball
Level 6
Level 6
Posts: 1081
Joined: Tue Nov 24, 2009 1:52 pm
Location: /home/usa/mn/minneapolis/joe

Re: Integrating clonezilla into grub

Postby JoeFootball » Tue Nov 07, 2017 3:39 pm

yamahama wrote:i'll write up updated instructions here in case someone finds it useful.

I'm sure someone will appreciate that, and it does sound like an interesting project. :)

Joe

yamahama
Level 1
Level 1
Posts: 14
Joined: Mon Nov 06, 2017 7:08 am

Re: Integrating clonezilla into grub

Postby yamahama » Tue Nov 07, 2017 3:50 pm

pbear wrote:Have to say, I don't see the point. If you want continuous backups of the whole system, you'd be much better off using rsync. That's one of the things it's designed for. Can't help you set it up, as I settled on a different backup strategy, but there are plenty of tutorials online.


hi pbear,
as far as i can tell rsync is for files and folders only and not for whole disks/partitions and mbr.

the point is partly glory, partly learning more about linux and partly to make the process of updating the software and configuration on old backups cleaner/easier.

User avatar
pbear
Level 4
Level 4
Posts: 240
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Integrating clonezilla into grub

Postby pbear » Tue Nov 07, 2017 3:58 pm

yamahama wrote:as far as i can tell rsync is for files and folders only and not for whole disks/partitions and mbr.

Honest, it'll do the job. I've seen detailed tutorials describing, written by system administrators who really need it to work.

That said, if you'd rather do it the other way, Linux is all about choice. Good luck.
Time flies like an arrow. Fruit flies like a banana.
Running Mint 18.2 Mate 64 bit

yamahama
Level 1
Level 1
Posts: 14
Joined: Mon Nov 06, 2017 7:08 am

Re: Integrating clonezilla into grub

Postby yamahama » Tue Nov 07, 2017 4:36 pm

So just a quick how i got this to work. The original guide here is honestly near perfect as long as you don't make typos so i'll just add a single note:

Apparently new versions of clonezilla no longer use aufs and if you get the "mounting aufs on /root/ failled" error, you need to add the option "union=overlay" to the menu entries to make it work as intended. so:

Code: Select all

menuentry "Clonezilla Live 2.5.2-31" {
set isofile="/boot/isos/clonezilla-live-2.5.2-31-amd64.iso"
loopback loop (hd0,1)$isofile
linux (loop)/live/vmlinuz boot=live components config findiso=$isofile ip=frommedia toram=filesystem.squashfs union=overlay username=user
initrd (loop)/live/initrd.img
}
       
menuentry "Clonezilla Live 2.5.2-31(Unattended Backup)" {
set isofile="/boot/isos/clonezilla-live-2.5.2-31-amd64.iso"
loopback loop (hd0,1)$isofile
linux (loop)/live/vmlinuz boot=live live-config noswap nolocales edd=on nomodeset union=overlay ocs_prerun=\"mount /dev/sdb1 /mnt\" ocs_prerun1=\"mount --bind /mnt/backup /home/partimag/\" ocs_live_run=\"ocs-sr -q2 --batch -j2 -z1p -i 2000 -sc -p reboot savedisk autoproductname sda\" ocs_live_extra_param=\"\" keyboard-layouts=\"\" ocs_live_batch=\"yes\" locales=\"\" vga=788 ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile
initrd (loop)/live/initrd.img
}

menuentry "Clonezilla Live 2.5.2-31 (Unattended Restore)" {
set isofile="/boot/isos/clonezilla-live-2.5.2-31-amd64.iso"
loopback loop (hd0,1)$isofile
linux (loop)/live/vmlinuz boot=live live-config noswap nolocales edd=on nomodeset union=overlay ocs_prerun=\"mount /dev/sdb1 /mnt\" ocs_prerun1=\"mount --bind /mnt/backup /home/partimag/\" ocs_live_run=\"ocs-sr -g auto -e1 auto -e2 -r -j2 -p reboot restoredisk autoproductname sda\" ocs_live_extra_param=\"\" keyboard-layouts=\"\" ocs_live_batch=\"yes\" locales=\"\" vga=788 ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile
initrd (loop)/live/initrd.img
}


Tested on Linuxmint Cinnamon 18.2 Cinnamon x64 with grub, burg and clonezilla v2.5.2-31 x64 iso.


Return to “Installation & Boot”