Getting the deleted partition back using TestDisk or Timeshift?

Come out of the chroot… CTRL D or I think exit,
Take the live usb drive out
Hit the reboot button
If the bios points to the hard disk, you should get a grub menu

So normally, removing the flash drive would make BIOS default to internal drive. But I will get into it to see not that it just points to it, but that it has Ubuntu named on it now because that is how it used to be listed in BIOS.

To confirm: once I get a grub, boot from there normally.

Yes.
Bios should default to the hdd.

YES!!! BIOS shows ubuntu in the disk name and I got the login screen. But grub was hidden at boot.

Do we need to do anything where I would need to reboot and show grub?

I think you can ignore that, it is just a hangover from kubuntu

Sometimes , if there is only one OS, it suppresses the grub menu, and goes straight to the login screen.
You can force a grub menu, by
edit etc/default/grub … there is some option to turn it on
update-grub

I am going to sleep.
Login and have a look at LM, and see if you are happy with it.

and

Now might be a good time to do a proper backup with Clonezilla

1 Like

You might want to use recovery mode, or have a choice of
kernels… I would get the grub menu going

Now I am in my Nov 2023 install. I am guessing it does not save my symlinks as that is in /home which is excluded from Timeshift.

I am now going to try and restore a different snapshot, more current. This should work now that I am no longer in a live system but my own. It has always worked for me before when rolling back after messing something up that did not prevent the system from booting.

However, relying on TS for this particular situation has proven not to be ideal if you really want everything back as it was.

I will look at how I can use Clonezilla alongside TS. TS is good for when you mess something up that still lets you boot your system, However, I am still going to have to do quite a few things from the restored snapshot version and I would rather not have to do that again next time…hope there is NOT a next time.

Sheila

Best way to use Clonezilla is from a live usb drive.
It needs all the filesystems unmounted.
Do disk- image… ie save the whole disk to an image file
and savedisk (not saveparts)

With your disk, it should take about half an hour to make an image on an external usb drive.

I have it on my Ventoy. I will do the image, but not till I have everything like I want it. All my app settings are not there (like Barrier, etc.) The apps are there, but the config files were probably on home so I have to go into each and point to them.

Will update.

I can’t thank you enough!!!

Sheila

1 Like

I do an image about once a month.
Dont delay too long, you want a fallback now you are here.

1 Like

I guess I could do it now so we have everything “as is” now without needing TS for this current state.

Thanks,
Sheila

Yes, do it now. You cant afford one slip up at the moment.
You can always do another one in a few days when you sort
out your software.

1 Like

Topic Summary - restore a deleted partition using Timeshift

This summary is a joint effort by @nevj and @Sheila_Flanagan

and

This topic started with an accidental deletion of a Linux Mint partiton. Mint happened to
be the Linux which controlled grub in a multiboot setup.

After numerous attempts at restoring a Timeshift snapshot post fresh install of Linux Mint, it was decided to wipe the drive and create the needed partitions, for a Mint-only system :

sda1 boot/efi   EFI System Partition
sda2 root/ext4  Linux Mint root filesystem
sda3 swap       Swap space

This would eliminate any residual elements that might prevent a successful restore of the snapshot.
Some previous attempts at restoring onto a remaining Kubuntu partition or onto a fresh Mint install had failed, and it was felt that the presence of Linux files not backed up by Timeshift was interfering with the restore attempts.

Recover Mint with Timeshift

Use a live USB flash drive of LM to start Timeshift.
Restore the Nov 23 snapshot to partition sda2
More recent snapshots were avoided as they had given trouble
This resulted in a Mint filesystem on /dev/sda2 , but not bootable because /etc/fstab was wrong
and there was no grub.

Fix /etc/fstab in the sda2 filesystem

Mount sda2 from the live USB LM
cd to the mount and into its etc subdirectory
edit the file fstab… change the UUID’s of all entries to those shown by
blkid for sda2 and sda3
also remove or hide the file boot/grub/grub.cfg

Install grub on disk sda

Attempts to install grub from a live LM session failed
The remedy involves a chroot into the recovered LM

Mount /dev/sda2 to /mnt

 mount /dev/sda2 /mnt

Do some bind mounts

sudo mount --bind /dev /mnt/dev &&
sudo mount --bind /dev/pts /mnt/dev/pts &&
sudo mount --bind /proc /mnt/proc &&
sudo mount --bind /sys /mnt/sys

Chroot into /mnt

sudo chroot /mnt

That puts us in a situation that treats /mnt as /

Update grub

sudo update-grub

That makes a new /boot/grub/grub.cfg file, using various files from /etc/default/grub.d
and the configuration file /etc/default/grub.

Mount the EFI system and install grub

sudo mount /dev/sda1 /mnt2
sudo grub-install --efi-directory=/mnt2 –target=x86_64-efi

That writes grub in the EFI System directory

Exit the chroot and reboot

The result

It boots LM from /dev/sda2, without a grub menu, going straight to the login screen.
One can force a grub menu by editing the file /etc/default/grub

The lesson learnt

From this exercise we have confirmed that while Timeshift might work for rolling back to recover from errors in a currently bootable system, it is not to be counted on for a complete backup to restore the entire state of the system. In particular, if grub is damaged, Timeshift can not help restore it.

For that, Clonezilla images are needed and should be updated as often as you want to be able to return to a desired state of your system.

3 Likes

The summary is nice! I do however have rescued an unbootable Arch with Timeshift. You need to chroot (or use arch-chroot in Arch) from live OS/another Linux os into the / and then run in terminal sudo timeshift --restore. It tries to restore grub but if it fails mount (in the chroot) the boot partition and update it. In Arch use sudo grub-mkconfig -o /boot/grub/grub.cfg, Ubuntu variants: sudo update-grub.

Timeshift does not backup any files in documents folders. It’s just for the system backups. I use deja dub for documents backup.

1 Like

I get it, if one does chroot first, and then runs Timeshift it will restore.
That would help, if one had lost grub.
but
if there was nothing on the filesystem to chroot into it would not work, would it?
One would have to restore or install something first.

When you say Timeshift will try to restore grub, do you mean it will restore the EFI System partition?
or
do you mean it will restore the grub files in /etc and /boot?

You’re right about this situation when there was nothing to chroot to. I just shared my experience with Timeshift.

I’m now in the timeshift’s GUI and there is option to choose where to restore

/
/boot
/home

And defaults are as they have been when you made the snapshot. There’s also advanced options for bootloader which are:

-(re)install GRUB2 on: (devices+partitions)
-Update initramfs
-Update GRUB menu

Thank you,
That means TS can do a full restoration of grub… the EFI partition ( or MBR if legacy) plus
the grub config files in the linux root partition.

So it is not just an rsync… it has some intelligence, if we can work out how to apply it.

One would normally choose /
Most distros do not have a separate /boot partition these days.
/home… well it might be useful to restore dot files, but not data
The issue with using TS for data is that it deletes things when restoring… one may not want that for data.

I use it as a system recovery app and deja dub to backup all my data to cloud. I would like to use cloud for timeshift also but it’s not possible.

1 Like

I think you need that for a rolling release like Gentoo, just in case an emerge goes wrong.

As we have “solved” this thread, I do want to add one more thing:

Even after rolling forward to a snapshot from last week and getting everything “right” again, the system was very laggy compared to my previous one. At first, I attributed it to TS having to do an entire first snapshot as it literally took 2 days.

This morning when it seemed slow to respond, I checked the system resources and found there was no swap available.

So apparently, the snapshot restored initially and even the latest, did not look at swap and fstab had no swap info.

I edited fstab and turned it on and now system is once again snappy. Just a warning that fstab probably needs to be checked after getting the restored system up and running to ensure this does not happen.

Sheila