LinuxQuestions.org
Help answer threads with 0 replies.
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 01-04-2010, 10:51 PM   #1
thedoctor
Member
 
Registered: Jan 2010
Posts: 47

Rep: Reputation: 15
Image Hard drive Ubuntu Operating system 9.10 Complete back up and restore


Image Hard drive Ubuntu Operating system 9.10 Complete back up and restore.

Changing over Hard Drives need a complete back up not just save files.

So the image can be restored on any hard drive that restores the computer to its original state before it was imaged.
 
Old 01-04-2010, 11:13 PM   #2
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
quick and dirty: from a live disk - total disk clone.

sudo swapoff -a
sudo dd if=/dev/sda | gzip > /path/to/storage/sda.dd.gz


restore it:

sudo gzip -dc /path/to/storage/sda.dd.gz | dd of=/dev/sda
sudo swapon -a


on systems that use uuids you may need to prepare them as normal dev labels first - to avoid conflicts. Or you can regenerate uuids in a script. If you have to do this a lot, then you'll be wanting to put all above in some sort of script which also handles pushing the image out over a network etc.

Last edited by Simon Bridge; 01-04-2010 at 11:21 PM.
 
Old 01-04-2010, 11:20 PM   #3
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
As you see I'm a bit of a traditionalist. There are lots of programs providing different amounts of control:
http://www.thefreecountry.com/utilit....shtml#imaging
 
Old 01-05-2010, 03:55 AM   #4
thedoctor
Member
 
Registered: Jan 2010
Posts: 47

Original Poster
Rep: Reputation: 15
Path

Tried the example from live disk several times without any success.

Thanks

Is there a way of saving it to a external Hard Drive.

I tried that with the sdb1.








Quote:
Originally Posted by Simon Bridge View Post
quick and dirty: from a live disk - total disk clone.

sudo swapoff -a
sudo dd if=/dev/sda | gzip > /path/to/storage/sda.dd.gz


restore it:

sudo gzip -dc /path/to/storage/sda.dd.gz | dd of=/dev/sda
sudo swapon -a


on systems that use uuids you may need to prepare them as normal dev labels first - to avoid conflicts. Or you can regenerate uuids in a script. If you have to do this a lot, then you'll be wanting to put all above in some sort of script which also handles pushing the image out over a network etc.
 
Old 01-05-2010, 04:14 AM   #5
sadiqdm
Member
 
Registered: Nov 2003
Location: London, UK
Distribution: openSUSE, Ubuntu
Posts: 358

Rep: Reputation: 35
I have successfully upgraded several machines with both Windows XP on NTFS partitions & Suse 11.1 on EXT3 partitions using CloneZilla. This was to replace existing hard drives with larger ones. In the case of one Win XP it was to provide a recovery solution, as I no longer have the install disks.

You need to give it a try first to understand the settings, but it will work between disks with different geometries. The best way seems to be to clone to a bare unformatted drive, and then resize & add partitions afterwards.

I was quite suprised the first time I did it with XP which was to replace a failing drive, and the machine came up with an error message at POST warning of a hardware change. Going into set-up and then rebooting and it all worked without any reconfiguration.

PartedMagic has a disk image function which will achieve the same result, but I haven't tried that yet.
 
Old 01-05-2010, 07:30 AM   #6
ongte
Member
 
Registered: Jun 2009
Location: Penang, Malaysia
Distribution: Mageia, CentOS, Ubuntu
Posts: 468

Rep: Reputation: 72
I second Clonezilla LiveCD. The best cloning tool on Linux by far.
 
Old 01-05-2010, 07:25 PM   #7
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Quote:
Originally Posted by thedoctor View Post
Tried the example from live disk several times without any success.
Need to know what you mean by "without any success" - what happened? Were there errors? What were they? I need to know exactly what you did - the best way to do this is to copy and paste from the terminal - including the command you entered with the resulting output.
Quote:
Is there a way of saving it to a external Hard Drive.
You can save the resulting .dd.gz to any drive that you have mounted.

You are unlikely to have enough RAM to save the disk image in the live session anyway. When I do this, I boot from an external HDD.

As the others have commented, you may be more comfortable with a gui tool like clonezilla. I gave you a link to a huge list with descriptions for all you options in my previous post.
 
Old 01-05-2010, 08:39 PM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Just to add an FYI. It you use dd to create an image file and pipe it through gz as Simon Bridge suggested; you can first use dd to create a zeroed file which nearly fills the disk, and delete the file. For a new installation on an old disk this will greatly reduce the size of the saved backup image.

Use "sudo df -B512 <device>" to learn how many free blocks are available. Then create a temporary file just shy of that size.

Here is an example using a formated, mounted image (I didn't want to mess with a partiton on my laptop):
Code:
df -B512 /mnt/tera/
Filesystem         512B-blocks      Used Available Use% Mounted on
/dev/loop3             1032080     72784    906872   8% /mnt/tera
jschiwal@qosmio:~> sudo dd if=/dev/loop3 | bzip2 >backup1.img
1048577+0 records in
1048577+0 records out
536871424 bytes (537 MB) copied, 209.76 s, 2.6 MB/s
:~> ls -lh backup1.img
-rw-r--r-- 1 jschiwal jschiwal 487M 2010-01-05 19:34 backup1.img
:~> sudo dd if=/dev/zero bs=512 count=906870 of=/mnt/tera/delete.me
906870+0 records in
906870+0 records out
464317440 bytes (464 MB) copied, 5.2989 s, 87.6 MB/s
:~> sudo dd if=/dev/loop3 | bzip2 >backup2.img
1048577+0 records in
1048577+0 records out
536871424 bytes (537 MB) copied, 37.9564 s, 14.1 MB/s
:~> ls -lh backup2.img
-rw-r--r-- 1 jschiwal jschiwal 45M 2010-01-05 19:36 backup2.img
I first copied a large media file and removed it for this demonstration to simulate a used hard disk. ( I did forget to delete the zeroed file as well. Doggonit! ) I should have named the backups with a .bz2 extension.

I wouldn't recommend using images for regular backups, but they are useful after a fresh installation to quickly recover after a hard disk failure.

Last edited by jschiwal; 01-05-2010 at 08:55 PM.
 
Old 01-06-2010, 02:11 AM   #9
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
A lot of corporate CTOs like to mandate disk images as a failsafe. I've also seen internet cafes restore all their machines from an image each night to avoid malware.

For backups, we have so many other options - we can avoid high bandwidth costs by maintaining caching repositories and deploying thin clients to centralise maintenance. We can use offsite net storage for file backups - with utilities like rsync. The brute force approaches that we see so often are usually a response to having to put up with the restrictions built into a proprietary system.

Without knowing why thedoctor wants to clone the drive, we cannot really advise.

@jschiwal: I had no idea the saving was so great! I've mostly only done this on fresh installs to distribute to many identical machines.

How good is this as a zeroing method against forensic file recovery?
 
Old 01-06-2010, 02:45 AM   #10
lupusarcanus
Senior Member
 
Registered: Mar 2009
Location: USA
Distribution: Arch
Posts: 1,022
Blog Entries: 19

Rep: Reputation: 146Reputation: 146
Quote:
Originally Posted by Simon Bridge View Post
quick and dirty: from a live disk - total disk clone.

sudo swapoff -a
sudo dd if=/dev/sda | gzip > /path/to/storage/sda.dd.gz


restore it:

sudo gzip -dc /path/to/storage/sda.dd.gz | dd of=/dev/sda
sudo swapon -a


on systems that use uuids you may need to prepare them as normal dev labels first - to avoid conflicts. Or you can regenerate uuids in a script. If you have to do this a lot, then you'll be wanting to put all above in some sort of script which also handles pushing the image out over a network etc.
^^^^ Is the best way if you are just doing it on your personal computer.
 
Old 01-07-2010, 10:34 PM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Quote:
Originally Posted by Simon Bridge View Post
@jschiwal: I had no idea the saving was so great! I've mostly only done this on fresh installs to distribute to many identical machines.
My example was a little contrived because I filled the filesystem with a large file and then deleted that file before my test. If you are starting with a used drive that was once filled to capacity, you can see similar dramatic results. I once demonstrated this using my /boot partition, and got good results. The laptop I use now doesn't have a separate partition for /boot, so I used a 500 MB file instead for the demonstration. But as you use compressed images to prepare "many" machines, a 50% savings could free up a lot of bandwidth and time.
Quote:
How good is this as a zeroing method against forensic file recovery?
You would need special hardware to recover information written over. However zeroing free space won't cover the slack space between the end of a file and the end of a sector on the disk. Also, if some parts of the drive are swapped out as bad by the drive, this area which once contained files won't be zeroed out. When you wipe a drive, you want to use pseudo-random numbers to write over the drive, at least twice. Or use a secure wipe function that is part of the drive itself.

Last edited by jschiwal; 01-07-2010 at 10:45 PM.
 
Old 01-07-2010, 11:18 PM   #12
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Thanx.

ref your sig:

Owed to a Spell Chequer

I halve a spelling chequer
It came with my pea sea
It plane lee marques four my revue
Miss steaks aye ken knot sea

Eye ran this poem threw it
Your sure reel glad two no
It's vary polished in it's weigh
My chequer tolled me sew

A chequer is a bless sing
It freeze yew lodes of thyme
It helps me awl stiles two reed
And aides mi when aye rime

To rite with care is quite a feet
Of witch won should be proud
And wee mussed dew the best wee can
Sew flaws are knot aloud

And now bee cause my spelling
is checked with such grate flare
Their are know faults with in my cite
Of nun eye am a wear

Each frays come posed up on my screen
Eye trussed to be a joule
The chequer poured o'er every word
To cheque sum spelling rule

That's why aye brake in two averse
My righting wants too pleas
Sow now ewe sea wye aye dew prays
Such soft wear for pea seas

http://www.phys-astro.sonoma.edu/peo...ngChequer.html

even: sill oh ate.
 
Old 01-14-2010, 10:25 AM   #13
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Thanks for the poem. Your SpellChequer must have a poetic license plugin.
 
Old 01-15-2010, 12:36 AM   #14
thedoctor
Member
 
Registered: Jan 2010
Posts: 47

Original Poster
Rep: Reputation: 15
imaging the hard drive

Will that program work if saving to a external hard drive as in sdb1.

Thanks






Quote:
Originally Posted by Simon Bridge View Post
quick and dirty: from a live disk - total disk clone.

sudo swapoff -a
sudo dd if=/dev/sda | gzip > /path/to/storage/sda.dd.gz


restore it:

sudo gzip -dc /path/to/storage/sda.dd.gz | dd of=/dev/sda
sudo swapon -a


on systems that use uuids you may need to prepare them as normal dev labels first - to avoid conflicts. Or you can regenerate uuids in a script. If you have to do this a lot, then you'll be wanting to put all above in some sort of script which also handles pushing the image out over a network etc.
 
Old 01-15-2010, 07:58 PM   #15
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Simply mount the external drive and redirect the output of gzip to a file on it.
So if you mount it on mnt/, then
sudo dd if=/dev/sda | gzip > /path/to/storage/sda.dd.gz

Doing an image backup of sda would be better done using a live cd. If you need to restore, you will probably be using a live CD anyway.
 
  


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
How to make an image (back-up) for easily restoring tweaked operating system CharlieBucket Linux - Software 2 09-23-2007 05:32 PM
hard drive image back up ciberrust Linux - General 16 01-19-2007 03:08 AM
Partitioning my hard drive for another operating system. Chuong Linux - Software 5 11-09-2006 04:26 PM
back up entire hard drive to image file? with a live cd n_md Linux - Software 2 02-01-2006 04:04 AM
installing linux on unformatted hard drive with no operating system gjhowar Linux - Newbie 4 08-18-2004 05:29 PM


All times are GMT -5. The time now is 07:25 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration