Restoring a bricked dual-boot?

Discussion in 'all things UNIX' started by bellgamin, Jan 18, 2022.

  1. bellgamin

    bellgamin Registered Member

    Joined:
    Aug 1, 2002
    Posts:
    8,102
    Location:
    Hawaii
    This MUST be too simple to be true. To wit...

    I have used an Imaging App for several years in order to image my hard drive to an external drive. I do so 2X every week & retain images for 3-4 weeks. It images & restores from a UFD, of course.

    It seems to me that -- when it comes to a dual-boot Windows/Linux set-up -- the Imaging APP would image & restore ANY OR ALL of the partitions on my hard drive, including those for both Windows and Linux.

    If so, why would I need Timeshift or any other Linux back-up system?

    This is too simple to be true, right?
     
  2. reasonablePrivacy

    reasonablePrivacy Registered Member

    Joined:
    Oct 7, 2017
    Posts:
    2,004
    Location:
    Member state of European Union
    If imaging program creates sector-by-sector copy of linux partitions (or is able to read Linux filesystems) and MBR/GPT then it is fine.

    I am not a timeshift user, but I think timeshift in btrfs snapshot mode isn't really a backup. Just a snapshot tool that can revert changes provided underlying mass storage (ssd/hdd) and filesystem is not corrupted, because it uses the same storage and filesystem. I am not sure how Timeshift rsync works. If it can create copy on external mass storage then maybe it is enough for somebody that know how to reinstall bootloader, but I would still prefer external backup tool that can image whole drive (all partitions including Windows).
     
  3. xxJackxx

    xxJackxx Registered Member

    Joined:
    Oct 23, 2008
    Posts:
    8,626
    Location:
    USA
    That being the case it should work.
     
  4. bellgamin

    bellgamin Registered Member

    Joined:
    Aug 1, 2002
    Posts:
    8,102
    Location:
    Hawaii
    You have put your finger right onto the big IF. I have queried the Image App's tech support to obtain answers to that IF.
     
  5. Krusty

    Krusty Registered Member

    Joined:
    Feb 3, 2012
    Posts:
    10,210
    Location:
    Among the gum trees
    I've had a problem restoring an image containing Windows + Solus using Macrium Reflect a couple of times. The restore worked but I had to repair Solus boot as it somehow got hosed. That was on my MBR laptop. No such trouble with Windows + Kubuntu on my UEFI machine.

    @Brian K might be able to shed some light on why, but I can't remember the specific reason now.
     
  6. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,115
    Location:
    NSW, Australia
    I use image/restore with my Windows/Linux systems. I don't use Timeshift.
     
  7. bellgamin

    bellgamin Registered Member

    Joined:
    Aug 1, 2002
    Posts:
    8,102
    Location:
    Hawaii
    R-Drive Image (RDI) is what I use for imaging. I paraphrase the reply to my question, as just provided by RDI's tech support team.
    That is VERY good news. I assume that all imaging software will function equally well for dual-boot Windows/Linux set-up's.

    As is the case for @Brian K, I am no longer going to use Timeshare for backing up Linux. I am VERY grateful for that fact. I have nothing against Timeshare -- I'm sure it's an excellent app -- but I feel much more comfortable with my long-time app-friend, RDI.
     
  8. Krusty

    Krusty Registered Member

    Joined:
    Feb 3, 2012
    Posts:
    10,210
    Location:
    Among the gum trees
    "That is VERY good news. I assume that all imaging software will function equally well for dual-boot Windows/Linux set-up's."

    Nope! Not the case.
     
  9. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,115
    Location:
    NSW, Australia
    With a standard Windows/Linux dual boot, grub 2 is in the MBR. But not just in LBA 0 as some linux installs put grub 2 in the first 128 sectors. Some imaging apps don't give you the option of restoring these sectors. I think Krusty is referring to this issue.
     
  10. shmu26

    shmu26 Registered Member

    Joined:
    Jul 9, 2015
    Posts:
    1,549
    I use Macrium Reflect and it is totally reliable to restore both Windows and Linux partitions.
    But...
    1 It cannot resize the linux partition. If the original size doesn't fit where you want to put it, too bad.
    2 You cannot browse the linux partition
    3 You need to shut down your linux session in order to run Macrium.
    4 If you restore to a different paritition or a different disk, you will probably have serious boot problems. Not only because of grub, but also because of fstab. (Hint: TimeShift, if you go into advanced boot options and enable initramfs, will probably get your boot working)

    I don't know of any linux solution that can take a system image from a running system. The only thing close to that is MX snapshot.
     
  11. MisterB

    MisterB Registered Member

    Joined:
    May 31, 2013
    Posts:
    1,267
    Location:
    Southern Rocky Mountains USA
    The gnome disks utility does partition imaging and g-parted can resize both Linux and Windows partitions.. I've never used the disks utility for backup and restore but it does have the option. I assume it uses the dd command internally which does sector by sector copies and then compresses them. You can do compressed sector by sector images from the command line in Linux by piping the dd command into gzip, bzip or any other file compression utility. An example of this is given here:

    https://linuxconfig.org/how-dd-command-works-in-linux-with-examples

    In general, image backup isn't necessary with Linux. Backups can be done at the file system level with tar and gzip and that is how it is commonly done. With Windows there are boot and activation issues with file system backups.

    https://www.linuxtechi.com/create-backups-tar-command-linux/

    If you find that you can't boot a system, try Super Grub2. It will get you into a non booting system and from there you can restore the boot function by updating grub. "sudo update-grub" will usually do the trick but sometimes you will need to reinstall grub with sudo grub-install /dev/sda assuming sda is your boot disk.

    https://www.supergrubdisk.org/super-grub2-disk/

    https://help.ubuntu.com/community/Grub2/Installing
     
  12. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,115
    Location:
    NSW, Australia
    shmu26,

    Some tests with IFL (Image for Linux) on Mint 20.3. Mint partition size 20000 MiB, Used space 12420 MiB.

    The Mint partition was backed up with IFL (UFD). The Mint partition was deleted and the image was restored to the Free Space and resized to 15000 MiB by the IFL restore process. Mint booted.

    You aren't supposed to run IFL backups of the running Linux partition as the Linux files aren't locked but it works. IFL was installed in Mint and a backup image was created. IFL was booted from a UFD, the Mint partition was deleted and the image was restored to the Free space. All OK. Mint booted and seems fine but I don't suggest you do this by choice.

    I'll try some tests on restoring to different hardware later.
     
    Last edited: Jan 19, 2022
  13. shmu26

    shmu26 Registered Member

    Joined:
    Jul 9, 2015
    Posts:
    1,549
    Thanks for the report. So let me try to see what I can take away from it. Tell me if I got it right.
    1 IFL can restore to a free space that is smaller than the size of the original partition that the image was taken from.
    2 IFL can take an image from a running system, i.e., the system that IFL itself is running in, even though it is not officially supported.
    3 If you restore to the same place, the boot works. (That part I already knew...)
     
  14. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,115
    Location:
    NSW, Australia
    The answer to Q2 and Q3 is yes.

    Re Q1, I've misled both of us. I was restoring to 20000 MiB of Free space and the restore was resizing to 15000 MiB. I just tried to restore to 15000 MiB of Free space and saw "The destination is not large enough". This can be done with a Windows image as you can use Compaction but Compaction isn't available for an IFL Linux restore. Sorry.
     
  15. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,115
    Location:
    NSW, Australia
    Different hardware. MBR to UEFI.

    The Dell computer is a MBR system with Mint 20.3 installed. Grub is in the partition boot sector, not the MBR. This is so BootIt BM can boot Mint and other OS.
    An IFL image was created of the Mint partition.

    The target computer is a UEFI system, home built with a Gigabyte MB. BootIt UEFI is installed.
    The above image was restored to Free space using IFL. A grub boot folder was created in the ESP while in IFL.
    Mint 20.3 boots. No problems at all.
     
  16. wat0114

    wat0114 Registered Member

    Joined:
    Aug 5, 2012
    Posts:
    4,064
    Location:
    Canada
    As an experiment, I was able to successfully use my IFW boot USB drive to backup my Linux MX-21 root partition and encrypted home partition, and restore them. I was a bit surprised IFW was able to manage the encrypted home partition, because afaik, unless changes have been made lately, @Brian K will no doubt know :) IFW can not handle bitlocker-encrypted partitions unless bitlocker is first suspended before imaging. Obviously the encryption method used for Linux is not the same as bitlocker, but I thought it would still impose the same restrictions bitlocker does.

    EDIT

    btw, with MX-21, using MX Tools-> MX Snapshot, one can create an ISO of the current state of the installation, then burn it to USB, which can be booted from into the live environment, and from there you can install to disk the exact current state on the USB. It's certainly a little more involved than using an image/restore program, but with the added benefit of having the current live environment available on both the device's h/drive and the USB drive.
     
    Last edited: Jan 19, 2022
  17. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,115
    Location:
    NSW, Australia
  18. wat0114

    wat0114 Registered Member

    Joined:
    Aug 5, 2012
    Posts:
    4,064
    Location:
    Canada
    So if I understand correctly, IFW can backup a bitlocker encrypted partition in the "encrypted" state "Type B backup". From my experience, it has always been easiest and most efficient to suspend the bitlocker partition first before imaging, then when it is restored, it goes back to the encrypted state without any modification required on my part.
     
  19. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,115
    Location:
    NSW, Australia
    When I was using BitLocker I did Type A backups. When the image is restored the partition doesn't need to be re-encryped. Easy. It seems we both get the same result.
     
  20. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,115
    Location:
    NSW, Australia
    Different hardware. UEFI to MBR. I used the computers described above but I couldn't get Mint to boot via BootIt BM on the MBR computer.

    Mint would boot using the Super Grub2 UFD but this is once only boot. The UFD would be needed every time.
     
  21. wat0114

    wat0114 Registered Member

    Joined:
    Aug 5, 2012
    Posts:
    4,064
    Location:
    Canada
    Thank you Brian!
     
  22. bellgamin

    bellgamin Registered Member

    Joined:
    Aug 1, 2002
    Posts:
    8,102
    Location:
    Hawaii
    Using Linux, how can I find out if my newly acquired but used Thinkpad T450s is BIOS or UEFI?
     
  23. Krusty

    Krusty Registered Member

    Joined:
    Feb 3, 2012
    Posts:
    10,210
    Location:
    Among the gum trees
    UEFI machines still have BIOS.

    You should be able to press F10, F11 or F12, or similar on system start-up to boot into BIOS and see what's what there.
     
  24. Krusty

    Krusty Registered Member

    Joined:
    Feb 3, 2012
    Posts:
    10,210
    Location:
    Among the gum trees
    Also, depending on the OS there could be an 'System Information' section that might show such info too.
     
  25. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,115
    Location:
    NSW, Australia
    Boot your Linux OS.
    Menu (Start) button, Disks.
    Select the disk containing the Linux OS
    In Partitioning... is it GUID Partition Table
    In Volumes... Do you see an EFI System Partition

    Edit... If you have a BIOS system, Partitioning will be Master Boot Record.
     
    Last edited: Jan 20, 2022
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.