How can I burn a bootable ISO file to a partition on my hard drive to use as a rescue system?
To boot an ISO image from a partition:
(hd0,6) is just an example, you have to change it according to the partition you have.
Get the ISO (duh)
Select your partition where the ISO images is gonna be booted from. It doesn't need to be a special partition, it can be any format, or at least FAT, NTFS, EXT*. (I haven't tried with others)(if you want persistence, it has to be FAT). It can have other data in it, won't make a difference. Take a note of what partition it is, ie
/dev/sda6
Copy the ISO to your partition. To be organized, you can create a folder let's say
/isoboot/
in the root of the partition, then a subfolder with a name identifying the system, and paste the ISO there.Mount the ISO. The easiest with is to use the option
"Open with disk image mounter"
from the contextual menu in the file browser, right clicking on the file.Once mounted, go to the directory
/boot/grub/
and copy the filegrub.cfg
. Paste it inside/isoboot/<your_system_name>
.-
In your Ubuntu, open with sudo privileges the file
/etc/grub.d/40_custom
. Add the menuentry:menuentry 'Your name of the ISO system' { set root='hd0,6' # this mean /dev/sda6 configfile /isoboot/<your_system_name>/grub.cfg }
Run
update-grub
.
This is different on every ISO, grub config files may have different names
Configuring the ISO grub.cfg file, System Rescue CD
Open the file with your preferred text editor and make the following changes:
-
At the top of the file add the lines
set isofile=/isoboot/systemrescuecd-6.0.3.iso loopback loop $isofile probe -u $root --set=rootuuid set imgdevpath="/dev/disk/by-uuid/$rootuuid"
-
In the menu entries add the text in bold
menuentry "Boot SystemRescueCd using default options" { set gfxpayload=keep linux (loop)/sysresccd/boot/x86_64/vmlinuz archisobasedir=sysresccd archisolabel=SYSRCD603 img_loop=$isofile img_dev=$imgdevpath initrd (loop)/sysresccd/boot/intel_ucode.img (loop)/sysresccd/boot/amd_ucode.img (loop)/sysresccd/boot/x86_64/sysresccd.img }
menuentry "Boot SystemRescueCd and copy system to RAM" { set gfxpayload=keep linux (loop)/sysresccd/boot/x86_64/vmlinuz archisobasedir=sysresccd archisolabel=SYSRCD603 copytoram img_loop=$isofile img_dev=$imgdevpath initrd (loop)/sysresccd/boot/intel_ucode.img (loop)/sysresccd/boot/amd_ucode.img (loop)/sysresccd/boot/x86_64/sysresccd.img }
Configuring the ISO grub.cfg file, Boot Repair
Open the file with your preferred text editor and make the following changes:
-
At the top of the file add the lines
set isofile=/isoboot/boot-repair/boot-repair-disk-64bit.iso loopback loop $isofile
-
In the menu entries add the text in bold
menuentry "Boot-Repair-Disk session" { set gfxpayload=keep linux (loop)/casper/vmlinuz.efi file=/cdrom/preseed/lubuntu.seed boot=casper quiet splash iso-scan/filename=$isofile -- initrd (loop)/casper/initrd.lz }
Configuring the ISO grub.cfg file, Ubuntu with persistence
Here we will use ubuntu-16.04.6-desktop-i386.iso
WARNING: the filesystem type for persistence to work must be FAT
How to create a casper-rw file
Copy the casper-rw
file alongside the ISO
Open the file grub.cfg
with your preferred text editor and make the following changes:
-
At the top of the file add the lines
set iso_path=/isoboot/ubuntu/ubuntu-16.04.6-desktop-i386.iso loopback loop $iso_path
-
In the menu entries add the text in bold
menuentry "Try Ubuntu without installing" { linux (loop)/casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper iso-scan/filename=${iso_path} quiet splash persistent persistent-path=/isoboot/ubuntu --- initrd (loop)/casper/initrd } menuentry "Install Ubuntu" { linux (loop)/casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity iso-scan/filename=${iso_path} quiet splash --- initrd (loop)/casper/initrd } menuentry "Check disc for defects" { linux (loop)/casper/vmlinuz boot=casper integrity-check iso-scan/filename=${iso_path} quiet splash --- initrd (loop)/casper/initrd } menuentry "Test memory" { linux16 (loop)/install/mt86plus }
Accesing the systems from grub>
terminal
grub> configfile (hd0,6)/isoboot/<your system folder>/grub.cfg
Related videos on Youtube
GNULinuxOnboard
Updated on September 18, 2022Comments
-
GNULinuxOnboard over 1 year
I plan on reinstalling Ubuntu and I would like to burn a small bootable recovery system (like SystemRescueCD) to a partition on my hard drive, but still be able to install Ubuntu on the same drive and be able to boot Ubuntu and the recovery partition. Is this possible and if so, how can I do it? EDIT: My current Ubuntu version is 19.04.
-
guiverc over 4 yearsI use
dd
to write my ISO files to thumb-drives, so I'd just of=/dev/sd?? and write to the partition you want instead of the thumb-drive I usually use. Note: if you're not familiar withdd
(data dump) be careful with it, it'll overwrite your whole hdd/sdd if you give it a wrong parameter -
schrodingerscatcuriosity over 4 yearsYes it's possible, adding the right entry in the GRUB menu. In fact you could boot multiple isos, but that depends on the iso image.
-
GNULinuxOnboard over 4 yearsI am wondering if I’d need to install GRUB as well for this or if installing Ubuntu will cover that. I am familiar with dd, and I’m reinstalling anyway, so that’s not really a concern.
-
schrodingerscatcuriosity over 4 yearsYou just need to edit the existing GRUB of your Ubuntu installation.
-
Organic Marble over 4 yearsI could not get it to work on the same physical drive. Works great on a different physical drive. Following to see if someone shows how.
-
GNULinuxOnboard over 4 yearsI’m going to do it from a live system after I’ve wiped the drive. The only thing that will be left will be a backup partition so I can move my 200gb of crap onto the new installation. After I flash systemrescuecd or kaspersky recovery or whatever it is, I’ll install Ubuntu and leave the backup partition to move all my stuff onto Ubuntu.
-
GNULinuxOnboard over 4 yearsIt may actually be better to install Ubuntu first and leave 4gb of space for the recovery partition and then burn the ISO after that
-
-
Jags over 4 yearsis it possible to add Boot-Repair or other system recovery tools to the rescue ISO? Just in case, if there's no internet, system still can be recovered. Thanks.
-
schrodingerscatcuriosity over 4 years@Jags Yes, almost every debian/ubuntu systems can be added this way, others can be a bit more complicated (I could boot Manjaro, but it took me a while). Boot repair wouldn't be accessible if GRUB is broken :), although it could be run if the grub rescue shell is avilable.
-
Jags over 4 yearsThanks, so how could I add boot-repair or any other packages to the rescue ISO please.
-
schrodingerscatcuriosity over 4 yearsEvery ISO is a little different, tell what other ISO you need (besides boot-repair) and I'll add it to the answer.
-
Jags over 4 yearsThank you so much. I was thinking to first add (1) boot-repair and (2) grub-customizer to the Ubuntu Mate 19.04 x64 ISO. Then implement the System Rescue Partition as you have described in great detail.
-
Jags over 4 yearsI could also add ntfs-3g to the rescue ISO.
-
schrodingerscatcuriosity over 4 yearsThe ISO's are live systems, wich means any change you do, like installing packages, will be deleted on reboot. What you can do is create a persistent system, wich can be done with an ubuntu image, but I'm not sure with system rescue cd or other tools like it.
-
schrodingerscatcuriosity over 4 years@Jags Added boot repair.
-
schrodingerscatcuriosity over 4 yearsAdded Ubuntu with persistence.