Backup and restore using GParted

Your Opinion, please on backup / restore using GParted.
I have not completed this yet but would like to if you see any holes in this. My root partition is small at only 20 gigs. I used gparted to create and format a partition of the same size and ext4. I then, using gpartd again, copied root to this spared partition. Now, I will format an external disk partition again to ext4 and copy the root backup to this external partition. If root fails, I can boot my USB Linux, and again using gparted copy my backup root back over top of the old root. If the HD fails. I can still boot the USB Linux and format a new partition on a new HD and copy the external copy to the new HD partition. Does this make sense? Do you think it will work? The one thing I know I would have to do on a new HD is somehow update / run grub to point to the new partition. Thanks

1 Like

i would be happy to share my opinion and see if we can find something that will work for you :slight_smile:

if you don’t mind, i would like to move this discussion to a new thread so that it doesn’t get buried at the bottom of this one that is already solved. that way other people can offer help and also find this discussion if they are struggling with the same issue.

3 Likes

No Problem. I would enjoy reading the thoughts / opinions on this procedure.

1 Like

have you tried any parts of this process yet? if so, how is it going?

the one place i see this not working (i also have questions about a couple other parts) is that if the main hd fails, there will be no boot loader (grub) to tell your system to now boot from the usb even though there is a valid copy of your os there. does that make sense?

for the record, even though i had seen the copy and paste options in gparted, i had never used it. i was honestly doubtful that copying a whole partition to a usb would work so i tried it and it worked just fine. thanks for the suggestion :slight_smile:

1 Like

Great News! Gparted (gpart) backup to same HDD works just great and it’s fast. Well, fast on a SSD.
I now have 2 roots (/) on the same HDD. One a complete copy of the other and I can easily switch between the two with just a re-boot.
Imagine, loosing your root partition and being able to switch to the other root with minutes. Of course, it will only be as new as your last backup, but you will not have lost all of your changes / update to root. Now my root partitions are small at only 20 gigs each. I have not tested a restore from the USB or switching to another HDD. Maybe, someone with lots more experience with Linux would not mind testing / verifying this first part of my plan.
I willing to bet this would also work to increase the size of the root partition.

3 Likes

what are you wanting to be tested or verified?

1 Like

OK, if you don’t mind, verify that I did have 2 root partition on one HDD. To verify my procedure:
1 - Using Gpart(ed) create a partition => your existing root patition.
2 - Format it to ext4.
3 - Boot Linux USB
4 - Mount the root partition. Mount the new partition.
5 - Using Gpart, copy root to new partition.
6 - Using Gpart change flag on new partition to ‘Boot’
7 - Re-boot your system and it should be pointing to the new root.
------To verify and return to original root. --------
8 - Place a file or dir on root.
9 - Using Gpart change flag on original root back to ‘Boot’.
10 - Re-boot your system.
11 - Check for the file or dir you wrote on root. It should be gone.
Thanks

i think as long as you are able to boot into both partitions that would seem to be verification that you have successfully copied the first and have two copies. i don’t have the room on my hdd to test this as you asked, but did test the copy function of gparted by copying one of my internal hdd partitions onto my external. that copied partition booted just fine. i then ran a couple of shell scripts to see if they still worked. they did.

i will note that in my method i didn’t bother to pre-format the space that i copied my partition onto. i just right-clicked on a chunk of unallocated space on the destination hdd that was larger than the one i was copying and chose paste. that may save you a small piece of time if you choose to use this as your backup method in the future.

after that i ran update-grub so i could choose the copied partition on my external hdd when i booted. i have never toggled or changed the boot flag through gparted (something i also learned possible during this discussion). i believe updating grub to see and list both partitions will also save you from needing to change the boot flag if you so choose. the trick here being if you have two identical partitions on the same internal drive, you will need some way to identify which is which on the grub boot screen.

gparted can definitely be used to increase or decrease the size of partitions. i used it just a couple months ago to shrink my third partition so that i could increase the size of my fourth. everything worked just as expected.

1 Like

Thanks for all your testing. I used Clonezilla last night to backup the root to a external Micro disk and it seem to copy the files just like Gparted did. So to me, it looked like Clonezilla and Gpart did the same thing.

By this do you mean that when a person copies root to an extrernal HDD all they have to do is run update-grup and the disk can now be booted or did I miss something?

1 Like

i am happy to try and help when i can :slight_smile:

one of the other things that clonezilla can do is create an image of the partition you are interested in having as a backup. an advantage of the image over a clone or copy like the one i believe you have created is that there is some compression involved so it takes up less space. after my backup in january, i compared the space used on my hdd and what was taken up by the image created by clonezilla. the exact numbers are listed in the first link below, but there was a greater than 50% compression rate which is helpful for (possibly over-) cautious folks like myself who keep a few backups just in case the most recent has an issue.

i have read before (and there is a post in this forum [second link below]) that it is possible to mount one of these images to get access to individual files. i haven’t tried that process yet, but it is definitely on my list of interesting possibilities to play with one of these days.

to answer what i believe is the main point of your question: yes. i will use my copy process to try and explain why that is a qualified yes at least in my case.

when i used gparted to copy from my internal hdd to my external hdd, i chose to copy my third partition which has debian installed on it. i copied debian to the second partition on my external hdd (the first is where i keep timeshift snapshots/backups). running sudo update-grub locates that (hopefully) valid, bootable partition on the external drive and adds it as a boot option on the initial grub os choice screen.

the reason my answer in my case is a qualified yes is because of the placement of the partitions i chose to copy and paste to. if (in the admittedly very minor possibility case) i had chosen to copy my third internal partition to the first partition on the external drive and then i wanted to take that external drive (mine is a bare hdd in an enclosure) and put it in my laptop and use it as an internal drive, there would be no grub (no bootloader at all) to tell the system to load the os even though it is valid and bootable.

i do not know for certain (i don’t have an extra drive to test the possibility) that this would result in the os not loading. perhaps your suggestion of adding the boot flag with gparted will allow it to do so. i just wanted to add that there is a possibility in this particular case that things might not go as planned.

what i understand of your process so far leads me to believe that you would probably be able to boot a drive where you copied the first partition (grub is generally written to the beginning of the drive [though this can apparently be changed] when installing most linux distros) to an external drive and then installed that drive and used it internally. i again say “probably” and hedge my bets because the only time i have used clonezilla to perform a complete restore from a backup image was onto the same disk (i messed something up with an update) the image was written from. i have not yet had the need to restore a backup image to an entirely new disk because of disk failure. theoretically that is exactly part of what clonezilla was designed to do. i just haven’t tested that particular function.

i hope that’s not too many if’s, and’s, but’s or wall of text imposing :slight_smile: in general the reason i use a couple of different backup methods (timeshift and clonezilla as well as smartcontrol/smartd in the background) is because i just want to make doubly (and possibly triply) certain that if i do lose a disk there is some hope of recovering my more recent work.

1 Like

I am feeling a lot more comfortable with Linux esp now I know I can backup & restore the root partition. I have been using Linux about 80% of the time for the past 3 days, :smiley: Just curious, from both of you, as to whether you use Timshift with what setting and what do you use for your restore if Timeshift does not work? Thanks

1 Like

i use timeshift with most of the default settings that it came with as far as what folders to backup. i have mine saved to an external drive with rsync daily and keep just over two weeks worth of them (17) in case it takes me a while to realize a change i made has issues.

i use clonezilla as my timeshift backup. i try to remember to make a full system image monthly and keep three or four of those just in case.

2 Likes

A late reply Cordx, but as I learn more and re-read some of these replies a question will come to mind.

“after that i ran update-grub so i could choose the copied partition on my external hdd”

Do you remember or gave examples of how you; 1) use grud to list partitions and 2) use grud to change partition to boot.

1 Like

in a multi-boot set up like mine (3 distros on my internal hdd and 1 on the external), running sudo update-grub identifies and locates those distros and their partitions. it then lists them on a grub menu that comes up before i begin booting into any of them. my menu looks similar (except the version is 2 point something and the kernel numbers are also higher) to the one linked below. my default os (bodhi) is listed first (along with recovery and memtest options) and then the other two on my internal drive (ubuntu mate and debian) are listed with their partition designation (/dev/sda2 and /dev/sda3 in my case). the debian partition on my external drive is listed last and has a slightly different partition designation (/dev/sdb2) because it is in fact on a different drive than those listed as sda#.

1 Like

So, after you copy / installed on the external HDD all you had to do was run update-gurb. It found the OS on the external HDD and added it to the boot menu?
BTW, still running Windows XP?

1 Like

exactly. in this case i copied my internal copy of debian on to a partition on my external drive and grub gave me the choice to boot into it :slight_smile: installing multiple distros on the same internal drive can get messy with multiple grub installs, but i wouldn’t worry about that unless you have to.

no, i don’t still have xp. i would if the bandits hadn’t made away with my beloved (first laptop) thinkpad t42 last year. the grub menu above is just an image i found online to have something to show you without having to reboot and take a picture.

2 Likes

9 posts were split to a new topic: Discussion about using Timeshift

You can chose what you back up in timeshift, by including hidden files for example, which if your drive is encrypted this option will show. You can also use an external drive not your hard drive to do the back up on timeshift, which some also advise. Looking at GParted it does seem a very powerful tool and it is worth reading the whole of the manual before attempting to use. I have read it on the website, which takes some time to do, as I had to re-read some things on it. While it is a wonderful tool to use, personally I would not use on my my working disk, but use it on my experimental disk until I got used to what it does and fully understood how it does them. I certainly, feel it is a tool for the more experienced user not a learner.

1 Like

I have kind of given up on gparted as a recovery tool and switched over to Clonezilla. But even using that, it looks like you would have to have either a backup of he entire disk or backups of root, home, and boot partitions to recovery from a total drive failure. That means 3 different backup files. One for each partition. It’s beginning to sound like it would be easier just to reinstall Linux.

1 Like

clonezilla has an option to make an image of the whole disk. that is what i do monthly as my secondary (second to timeshift) backup plan in case i lose my whole drive. plenty of people choose a fresh install i believe. one of the main reasons i keep a clonezilla image around is just in case i don’t have a copy of some file or other that might get lost otherwise.

2 Likes