Integrating clonezilla into grub

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
yamahama

Integrating clonezilla into grub

Post by yamahama »

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.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Integrating clonezilla into grub

Post by pbear »

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.
User avatar
JoeFootball
Level 13
Level 13
Posts: 4673
Joined: Tue Nov 24, 2009 1:52 pm
Location: /home/usa/mn/minneapolis/joe

Re: Integrating clonezilla into grub

Post by JoeFootball »

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

Re: Integrating clonezilla into grub

Post by yamahama »

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 13
Level 13
Posts: 4673
Joined: Tue Nov 24, 2009 1:52 pm
Location: /home/usa/mn/minneapolis/joe

Re: Integrating clonezilla into grub

Post by JoeFootball »

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

Re: Integrating clonezilla into grub

Post by yamahama »

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.
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Integrating clonezilla into grub

Post by pbear »

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.
yamahama

Re: Integrating clonezilla into grub

Post by yamahama »

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.
User avatar
Walterjnr
Level 1
Level 1
Posts: 16
Joined: Thu Feb 25, 2021 6:58 pm
Location: Melbourne, Australia

Re: Integrating clonezilla into grub

Post by Walterjnr »

Sorry to revive such an old thread, but I tried this exact method of integrating Clonezilla into Grub, and after many hours and many more swear words, finally got it running. Part of me wanted to do it just to finish something that I started but now that I've got it running I'm not sure that running Clonezilla on the same HDD that I am currently imaging is the best thing. Perhaps others more knowledgeable than me can tell me whether it's ok to do this or should it be run from a totally separate partition or HDD?

It's certainly easier to do this than muck around with my Bios boot order that always resets to the main HDD after 5 or 6 boots so I hope to be able to use this method going forward.
User avatar
AndyMH
Level 21
Level 21
Posts: 13748
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Integrating clonezilla into grub

Post by AndyMH »

I developed foxclone, which is a lot more user friendly than clonezilla. The way I use it: All my PCs (3xlaptop, 1xdesktop) have a separate internal/removable 2TB backup HDD. There are two partitions on the HDD, a large ext4 one to store backups and a small ext4 partition with LM19.3 installed in it. foxclone is installed in LM19.3. When I boot, grub gives me the choice of either booting as normal or booting LM19.3 from the HDD to do a foxclone image backup (or restore, or clone).

As well as being able to boot into LM19.3 as normal, grub is also installed to the backup HDD so in the event that my main SSD fails I can still boot it. Why LM19.3 - simply to have a different OS to the main one on the SSD which is LM20.1.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
t42
Level 11
Level 11
Posts: 3744
Joined: Mon Jan 20, 2014 6:48 pm

Re: Integrating clonezilla into grub

Post by t42 »

Walterjnr wrote: Fri Apr 09, 2021 2:36 am I'm not sure that running Clonezilla on the same HDD that I am currently imaging is the best thing.
It makes no difference if you load the Clonezilla image from the same HDD. You only need to follow Clonzilla's standard warning not to place partimg home on the saved partition /disk. I'm regularly save a partition where Clonezilla image is placed.
-=t42=-
t42
Level 11
Level 11
Posts: 3744
Joined: Mon Jan 20, 2014 6:48 pm

Re: Integrating clonezilla into grub

Post by t42 »

Walterjnr wrote: Fri Apr 09, 2021 2:36 am Sorry to revive such an old thread, but I tried this exact method of integrating Clonezilla into Grub, and after many hours and many more swear words, finally got it running.
It's quite easy to implement. If someone is interested:

Place a Clonezilla image in /iso/ directory
Create a file /boot/grub/custom.cfg with this content:

Code: Select all

#-----------------------------
menuentry "Clonezilla live" {
set isofile="/iso/clonezilla-live-20210127-groovy-amd64.iso"
loopback loop $isofile
linux (loop)/live/vmlinuz boot=live union=overlay username=user config components quiet 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 toram=live,syslinux,EFI findiso=$isofile
initrd (loop)/live/initrd.img
}
#-----------------------------
Change clonezilla-live-20210127-groovy-amd64.iso for another Clonzilla version.
Just reboot, that's all.
-=t42=-
bodge99

Re: Integrating clonezilla into grub

Post by bodge99 »

Hi,

I'd view this as a worthy project.. Some folk have developed their own backup strategy and/or tools, some use existing tools such as Timeshift etc..
Unfortunately a large number of folk don't backup at all..

I personally would approach this particular project by extracting the Clonezilla iso(s) to a discrete partition on an external device (and mod from there)..
This could then be set up to support legacy or UEFI boot (32/64bit.. Yes, 32bit UEFI based kit does exist!) and so would be usable on any PC that has a USB port. You could then add tools or tweak Clonezilla to suit any specific requirements or ways of working.

I'm **NOT** saying that this is in any way "better" or that anyone should do this.. It's just a "thought experiment" for me at this stage.

A superb way to learn something new!

Bodge99
Moonstone Man
Level 16
Level 16
Posts: 6054
Joined: Mon Aug 27, 2012 10:17 pm

Re: Integrating clonezilla into grub

Post by Moonstone Man »

t42 wrote: Fri Apr 09, 2021 8:06 am Change clonezilla-live-20210127-groovy-amd64.iso for another Clonzilla version.
Just reboot, that's all.
Thanks for that. I'm going to give it a burl.

Edit: It worked like a charm, thanks again.
t42
Level 11
Level 11
Posts: 3744
Joined: Mon Jan 20, 2014 6:48 pm

Re: Integrating clonezilla into grub

Post by t42 »

You're welcome!
-=t42=-
User avatar
Walterjnr
Level 1
Level 1
Posts: 16
Joined: Thu Feb 25, 2021 6:58 pm
Location: Melbourne, Australia

Re: Integrating clonezilla into grub

Post by Walterjnr »

I tried performing a restore with this setup, and while it all worked in the end, I'm unsure about one part of it. After the image was restored it went through a process of rebuilding GRUB. I've never seen this before so wasn't sure how normal this was. I've performed a few restores whilst using LM, plus many years of using Clonezilla with Windows, and haven't had this pop up until now. GRUB was installed at the time but the menu was always hidden. Does Clonezilla need to rebuild GRUB if there are modifications to the GRUB files? I really like the simplicity of having Clonezilla built in to GRUB so I don't want to go back to booting USBs or CDs if I can avoid it.
Moonstone Man
Level 16
Level 16
Posts: 6054
Joined: Mon Aug 27, 2012 10:17 pm

Re: Integrating clonezilla into grub

Post by Moonstone Man »

Walterjnr wrote: Fri Apr 09, 2021 10:04 pm Does Clonezilla need to rebuild GRUB if there are modifications to the GRUB files?
No. Clonezilla must always reinstall grub. The fact that you've not seen Clonezilla do this before implies only that you've never noticed it before.

Grub must be reinstalled because it takes up the first few bytes of the drive for the bootstrap loader, then switches to the grub stored on a partition, which the bootstrap points to. The bootstrap, by definition, lies outside of any and all partitions, and since Clonezilla images partitions it therefore follows that grub must be reinstalled.
User avatar
Walterjnr
Level 1
Level 1
Posts: 16
Joined: Thu Feb 25, 2021 6:58 pm
Location: Melbourne, Australia

Re: Integrating clonezilla into grub

Post by Walterjnr »

Kadaitcha Man wrote: Fri Apr 09, 2021 10:30 pm
Walterjnr wrote: Fri Apr 09, 2021 10:04 pm Does Clonezilla need to rebuild GRUB if there are modifications to the GRUB files?
No. Clonezilla must always reinstall grub. The fact that you've not seen Clonezilla do this before implies only that you've never noticed it before.
That was my other thought. Thanks for clarifying that.
Locked

Return to “Installation & Boot”