LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-04-2013, 03:52 AM   #1
melodyintrance
LQ Newbie
 
Registered: Mar 2013
Posts: 3

Rep: Reputation: Disabled
How to Create System Recovery Partition in Linux Ubuntu


Hi folks, I've recently switched my HTPC from Windows 7 to Ubuntu 12.10 64bit. I want to create a snapshot of the OS partition so I can easily restore if needed.

My HTPC has 1 hard disk which has 3 partitions.
1. 70GB Ubuntu (7GB used)
2. 2GB Swap
3. 75GB New (Unallocated)

I would like to achieve the following:
  1. Choose from a boot loader (Grub2 in this case) and select the "Backup" option.
  2. Either Clonezilla or similar loads and automatically creates a backup of the Ubuntu partition
  3. The backup image is saved locally AND on the NFS filie server
  4. The backup image is compressed so it only backs up the 'used' content instead of the entire 70GB
  5. Choose from the boot loader and select "Restore" option which obviously repeats the process above except it restores from backup image.

I've been reading through my copy of the Linux Bible and other tutorials and I want to put some of this theory into practice.

So far I was thinking of doing the following:
  1. Add Grub2 option to boot from clonezilla live iso
  2. Run saved script or command line in clonezilla to perform the backup into the other 75GB partition and NFS server.
  3. Run saved script or command line in clonezilla to perform the restore from the other 75GB partition or NFS server.

Am I on the right track? Could someone suggest best practice approach for this outcome?

Cheers, Pete
 
Old 03-04-2013, 10:02 AM   #2
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-19-live-usb/ aix
Posts: 3,820

Rep: Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586
i would add zeros to the end of the disks like so:
Code:
dd if=/dev/zero of=some/big/file
rm some/big/file
then i would image backup the disks like so:
Code:
dd bs=8192 if=/dev/sdd | bzip2 > xbmc-01.05.2011.iso.bz2 # to create the image
bunzip2 -c ./xbmc-01.05.2011.iso.bz2 | dd bs=8192 of=/dev/sdd # to restore the image
warning: this is a very destructive process; you need to be triply sure that you are restoring to the correct devices.
 
Old 03-04-2013, 02:37 PM   #3
thorkelljarl
Senior Member
 
Registered: Jun 2008
Posts: 1,721

Rep: Reputation: 192Reputation: 192
Why not backup...

You can of course make a system recovery partition on your present HDD, but I would think that you'd be better off if you instead relied on a good chronological backup program for your system or for its important files.

As a true backup, on another HDD, internal or external, you guard against failure of your HDD. That is the total loss of everything on your system. not just an annoying but repairable episode you can fix with a recovery partition.

Unless you're running a server or some critical always-on application, I wouldn't think you'd have to worry about your linux OS going down, causing chaos, taking everything with it and loosing your files. That is unlikely; your linux installation is more robust than Windows and if needs be, easier to re-install.

I could always add that as a wise and experienced linux user you already have backup and really only need to think of a way to configure it to satisfy your current wishes. Could I be wrong?

I use the program Back in Time which is incremental but doesn't use compression, copying to an external HDD with an SATA connection. The files being without compression makes it easier for me to copy everything back to my installation HDD as I want. When the time comes, I can just format my HDD to do a new installation of openSUSE or mess things up by fooling around with some new distro.
 
Old 03-04-2013, 03:29 PM   #4
goumba
Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Debian Wheezy (7.0), Jessie (future 8) and Sid (unstable)
Posts: 510
Blog Entries: 2

Rep: Reputation: 55
Quote:
Originally Posted by schneidz View Post
i would add zeros to the end of the disks like so:
Code:
dd if=/dev/zero of=some/big/file
rm some/big/file
Isn't there a tool zerofree or such that makes it a one step process?
 
1 members found this post helpful.
Old 03-05-2013, 01:57 PM   #5
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-19-live-usb/ aix
Posts: 3,820

Rep: Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586
Quote:
Originally Posted by thorkelljarl View Post
Why not backup...

You can of course make a system recovery partition on your present HDD, but I would think that you'd be better off if you instead relied on a good chronological backup program for your system or for its important files...
i agree, however i have a 2 gb xbmc live-usb that i made an image backup with so that if it flakes out i can restore it in about 5 minutes without having to re-install all the add-ons and re-edit the different config files...

the internal hd has 250 gb of movies and music that is also saved on my phone, camera and mp3 players. so that if i accidentally delete something i can manually copy it from wherever.

i think images make sense when they are as small as possible and they contain just the core os and various configs.

incremental backup makes sense for actual data recovery.
 
Old 03-13-2013, 06:57 AM   #6
melodyintrance
LQ Newbie
 
Registered: Mar 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for your replies everyone.

This HTPC is dedicated to run XBMC and act as the upnp server. So far it's only using around 7GB in total. I bet I could make it leaner too because it has ubuntu unity desktop environment installed which is a waste of space. The media is stored in a separate Freenas server.

I have to lean towards Schneidz that making a partition image backup would be ideal due to the considerably small 'used partition space'. Maybe what I'll do is reduce the size of the main partition from 70GB to 8GB. This way the image of the partition will be small and I can write a script to alert me when the partition is running low on space or perhaps automatically grow the partition size by booting into gparted iso...

I came across this post http://ubuntuforums.org/showthread.php?t=1549847 which shows you how to create a grub 2 option to boot to an iso (maybe clonezilla or ghost4linux) so I'll test out this tomorrow and report back.
 
Old 03-13-2013, 04:20 PM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 1,984

Rep: Reputation: 512Reputation: 512Reputation: 512Reputation: 512Reputation: 512Reputation: 512
Don't forget you need a system with enough capability to restore it...
And you better test it when you do.
 
Old 03-24-2013, 09:49 PM   #8
melodyintrance
LQ Newbie
 
Registered: Mar 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Just thought I've give you guys an update.

Hey folks, I've had a hell of a learning experience over the past week!

This is what I've managed to do so far:
  1. created ext4 partition for 'system rescue live ISO'
  2. created grub2 entry to boot into the 'system rescue live' session
  3. created a sh script to mount my nfs file server to /mnt/backup
  4. run fsarchiver to save sda1 to nfs backup folder (sda1 is the XBMC partition)

When the system rescue boots (from sda3) it runs the xbmc_backup.sh which sits on the nfs fileserver but only after I manually mount the nfs partition.

Things to do:
  1. Find a way to add my 'mount -t nfs...' command into the stab of 'system rescue' so it's persistent.
  2. Find a way to automatically shut down XBMC and boot into the 'system rescue' session and automatically perform backup and once finished restart the XBMC session.
  3. Find a way to replace 'system rescue' with a smaller live session that is only command line or compile system rescue live without X11 / gui


fsarchiver backed up the xbmc partition (used 4.8G out of 9.8G) and saved a compressed backup file less than 3.0G. The backup ran for around 11 minutes.

Last edited by melodyintrance; 03-24-2013 at 09:50 PM. Reason: added backup duration
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] Dual boot Windows 7, Ubuntu and Recovery Partition glock356 Ubuntu 3 11-28-2012 01:39 AM
script to create partition and file system on the partition mukheema Red Hat 1 02-03-2012 12:29 PM
[SOLVED] How to make a recovery partition windows like of my root folder[ubuntu] silvyus_06 Linux - Newbie 14 01-04-2011 02:53 PM
Ubuntu 9.10 System Recovery Help Needed cwfrad Ubuntu 3 02-25-2010 11:20 PM


All times are GMT -5. The time now is 05:26 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration