Image Hard drive Ubuntu Operating system 9.10 Complete back up and restore
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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.
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.
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.
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.
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?
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: 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.
Will that program work if saving to a external hard drive as in sdb1.
Thanks
Quote:
Originally Posted by Simon Bridge
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.