LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 02-21-2021, 02:34 PM   #1
jan128
Member
 
Registered: Nov 2020
Posts: 201

Rep: Reputation: Disabled
How to save entire OS partition?


This is a serious matter, so please treat it that way.
After spending days recovering my limping system I need a serious way to save / backup operating system , not some silly data, got that covered.

Here is "the spec" :
Manually, nothing automatic, preferably using command line , not GUI
backup / copy /save the entire operating system PARTITION to another PARTITION.
The "copy to " partition must be enabled so grub to find it, hence eventually boot able as the original.

The reasons are simple:
Upgrading to new version release is "Russian roulette " - going from Ubutu 16 to 18 on-the -fly took almost an hour. Downloading from ISO USB stick is much gooder, but not too "what is happening , progress" oriented.

Both methods are hard to verify if all previous packages are still workable.

So my "primary directive" is NOT to have download packages AFTER the OS fails.

I had good luck with "ddrescue". Can anybody recommend alternative or is that as good as it gets with Linux ?

Secondary though - would RAID5 work to do the above "automatically"? I realize if something catastrophic happen to running OS and it gets passed to RAID array the system may not boot again using the RAID array. That is why I am using multiboot anyway and it saved me from total meltdown many times.

Last edited by jan128; 02-21-2021 at 02:40 PM.
 
Old 02-21-2021, 03:46 PM   #2
uteck
Senior Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: Ubuntu based stuff for the most part
Posts: 1,179

Rep: Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501
You need a backup tool like clonezilla https://clonezilla.org/ which I have used to backup my MythTV boot partition and restore it after the OS update left it unbootable.

RAID5 is not a backup solution, so no it will not do you want. You could use a RAID1, were you remove one of the drives then do the update, and if it fails remove that drive and put the other back, boot from it and wipe the failed drive and then put it back in and rebuild the array.
 
Old 02-21-2021, 03:47 PM   #3
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,904
Blog Entries: 1

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Ability to readily and conveniently save an OS partition onto the same system is one of several advantages to configuring a system in multiboot. So configured the admin can clone one partition to another using yet another, or save it to a file on any mounted filesystem (other than the source). The source cannot be the booted system because of open files and potential file corruption on both source and target on subsequent boot(s).

You cannot succeed to have a bootable pure, direct clone of any OS partition to another partition on the same system and have either be bootable without tweaking one or the other to remove all references to the duplicated filesystem LABELs (if any) and UUIDs in bootloader configurations and fstabs. Any time such tweaks are not made, tragic filesystem corruption can be expected.

For cloning and imaging (compressed or not), which are backup routines here, I use the same non-free application that I use for partitioning and for OS and partition inventory management: DFSee. The same instance can both create a new target partition, and clone to it. Bootloader management must be done separately afterward.
 
Old 02-21-2021, 08:40 PM   #4
jan128
Member
 
Registered: Nov 2020
Posts: 201

Original Poster
Rep: Reputation: Disabled
Thanks for replies.
I am not sure I should worry about duplicating ID's
If I clone partition of NOT currently running OS AND do not run "update-grub" I should not see the cloned OS in the grub menu next time I reboot.
I know this does not agree with posts here, but that is my current experience - grub does not automatically update on reboot.
So if my primary OS fails - either boot or faulty package - I should be able to switch to backup OS ( 3rd OS in the schema ) - do update-grub and on next reboot select the cloned OS.

I realize it is convoluted process, but beats going thru same "recovery" for hours - likes last time.
I'll take a look on implementing RAID1 - I always prefer KISS method.
 
Old 02-21-2021, 08:59 PM   #5
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,904
Blog Entries: 1

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by jan128 View Post
If I clone partition of NOT currently running OS AND do not run "update-grub" I should not see the cloned OS in the grub menu next time I reboot.
Grub won't be affected with that action until time comes for a Grub update, but the kernel can be any time. You may or may not be booting what you think you are booting if UUIDs are not unique. You may load kernel and initrd from the one specified by Grub, but find mounted the other. You'll need to check the device name each boot to know which of the two identical UUIDs got mounted to /. I hazard to guess the result once time comes for a Grub update, unless os-prober is disabled.

Making UUID unique on a cloned partition is simple enough using tune2fs, which can change or add a LABEL in the same operation. No mounting of the target is required to do so.
 
Old 02-22-2021, 03:19 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,023

Rep: Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632
There is no best backup solution.

One can use things like Clonezilla to backup parts or all of your system. Clonezilla uses common other programs that you could use alone.

If you simply want to copy file by file of the OS part and not the loader then I might use Gparted.
 
Old 02-22-2021, 06:53 PM   #7
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by jan128 View Post
I'll take a look on implementing RAID1 - I always prefer KISS method.
Raid 1 is great for the OS. Raid 5 or 6 for your data (/home).
Either way a single drive failure and you still keep going.
 
Old 03-03-2021, 10:32 PM   #8
Friesen65
LQ Newbie
 
Registered: Mar 2021
Posts: 1

Rep: Reputation: Disabled
After cloning or imaging your OS, you can copy it to your new hard drive now. If you image it, you can restore it to your new hard drive. And that's done. Of course, if you don't think your operating works well, you can choose to reinstall it on your new hard drive.




MyFordBenefits.Com

Last edited by Friesen65; 03-08-2021 at 03:35 AM.
 
Old 03-03-2021, 11:59 PM   #9
verndog
Member
 
Registered: Oct 2007
Posts: 279

Rep: Reputation: 68
fsarchiver might work:
clone partition:
Code:
sudo ./fsarchiver -j6 -o savefs NAMEIT.fsa /dev/<FROM>
restore partition:
Code:
sudo ./fsarchiver restfs NAMEIT.fsa id=0,dest=/dev/<TO>

Last edited by verndog; 03-04-2021 at 12:00 AM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Transferring from save file to save partition hda7 Puppy 2 05-04-2010 08:11 AM
Suse 9.3 Korganizer Custom Schedule, or Save Entire Day as Template -swimmer- Linux - Newbie 0 08-31-2005 09:26 PM
Windows XP hogs entire 40 GB Hard Drive with one Partition jedi_zach Linux - General 2 02-09-2004 12:29 AM
Backing up entire Linux System (partition) podollb Linux - Software 4 10-14-2003 10:01 PM
taking image of entire partition. noname Linux - Software 4 05-14-2002 11:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 07:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration