LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Image Hard drive Ubuntu Operating system 9.10 Complete back up and restore (https://www.linuxquestions.org/questions/linux-newbie-8/image-hard-drive-ubuntu-operating-system-9-10-complete-back-up-and-restore-779857/)

thedoctor 01-04-2010 09:51 PM

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.

Simon Bridge 01-04-2010 10:13 PM

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.

Simon Bridge 01-04-2010 10:20 PM

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

thedoctor 01-05-2010 02:55 AM

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 (Post 3814293)
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.


sadiqdm 01-05-2010 03:14 AM

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.

ongte 01-05-2010 06:30 AM

I second Clonezilla LiveCD. The best cloning tool on Linux by far.

Simon Bridge 01-05-2010 06:25 PM

Quote:

Originally Posted by thedoctor (Post 3814551)
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.

jschiwal 01-05-2010 07:39 PM

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.

Simon Bridge 01-06-2010 01:11 AM

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?

lupusarcanus 01-06-2010 01:45 AM

Quote:

Originally Posted by Simon Bridge (Post 3814293)
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.

jschiwal 01-07-2010 09:34 PM

Quote:

Originally Posted by Simon Bridge (Post 3815813)
@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.

Simon Bridge 01-07-2010 10:18 PM

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.

jschiwal 01-14-2010 09:25 AM

Thanks for the poem. Your SpellChequer must have a poetic license plugin.

thedoctor 01-14-2010 11:36 PM

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 (Post 3814293)
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.


jschiwal 01-15-2010 06:58 PM

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.


All times are GMT -5. The time now is 03:11 PM.