Backup/restore and/or cloning of a hard drive Ubuntu 7.10
UbuntuThis forum is for the discussion of Ubuntu Linux.
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.
Backup/restore and/or cloning of a hard drive Ubuntu 7.10
I have 7.10 installed and working to my liking. So now it is time to make a backup. For my first try I used Norton Ghost 8 and made a complete hard drive image. I restored it to a like model drive. It does not boot - Grub error 15.
So I am thinking that the MBR is hosed and perhaps Ubuntu installs Grub there - it did not give me a choice. With Fedora I always installed Grub on /dev/sda1. I copied the MBR from the first drive to the second thusly:
from the original drive...
dd if=/dev/sda of=/media/myusbdrive/backup.mbr count=1 bs=512
to the new drive...
dd if=/media/myusbdrive/backup.mbr of=/dev/sda count=1 bs=512
Still no luck. I tried backing up and restoring the partitions using g4l which I have used successfully with Fedora (providing I do no use LVMs). Still no success.
I installed Ubuntu 7.10 from scratch on the new drive. I then restored the g4l images of the partitions. Now I can boot however I am told "...your home directory is /home/ken... it is not present..." I looked at the drive from the live CD and the directory and files are present.
Which gets me to I think the root cause (pardon the pun). I looked at the fstab file and the partitions are identified with UUIDs. They are of course different on the new drive after the format/install although I am not sure why the initial Ghost copy did not set them the same as the originals??? So My next step will be to edit the fstab values to match the values on the disk. I believe I can determine these with ls -l /dev/sda -by-uuid.
Here is my unresolved question... Where are the UUIDs stored by Grub? and how can I edit them when Grub will not boot? I believe that is why my first attempt at cloning did not work.
So now my plan of attack is:
1 - take the dog for our afternoon walk
2 - shut down windoze and pull the windoze drive tray
3 - install my "new" Ubuntu drive
4 - boot from the live CD
5 - make the fstab changes as discussed above
Later,
Ken
p.s. I think a Microsloth refuge must be working on Linux now. Smacks of Windoze SIDs. Is there a UUID changer for Linux similar to the SID Walker from Symantec???
Thanks Simon for your detailed reply. A simple dd will not do what I am looking for long term. I have partitioned my hard drive thusly:
/ 10 GB
/home 20 GB
/vmworld the rest ~ 50 GB for VMWare and virtualbox images
I can hot backup /home and /vmworld (which represent the bulk of my data) to another drive or server. rcsync might be of use in this regard. What I am trying to accomplish is to snapshot the Operating System as installed and configured in the event of a hard drive failure or some mischief which renders the OS or installed programs unusable.
I removed UUIDs from fstab and from /boot/grub/menu.lst and the machine would boot. However, I could not login as it was unable to access my /home/ken directory structure. I received an error message relating to permissions. I wonder if permissions are assigned based on the UUID where the directory or file is created???
Stranger than truth... It seems the my problem resulted from the OS not being able to find the swap partition(?) I performed the following process successfully:
1 - I transferred the drive partition layout from the original to the new drive using sfdisk (easier than doing it manually)
2 - I transferred the boot sector using dd as described earlier.
3 - I moved the / and /home partitions using g4l (Ghost for Linux) which is basically a menu driven dd process.
4 - I booted the new drive and received the same error re. my /home/ken directory not being available to me.
5 - I booted the live CD and made the following repairs:
- determine the UUID for partitions sda1, sda2, sda3, sda4 using sudo vol_id -u /dev/sda1 etc. and recorded these
mkdir /repair
mount /dev/sda1 /repair
I then examined fstab
sudo gedit /repair/etc/fstab
The UUIDs for sda1 (/) and sda3 (/home) matched as I had in effect copied them with dd.
The UUID for sda2 - the swap partition - did not match so I replaced the value in fstab with the value determined with vol_id -u.
The UUID for sda4 (/vmworld) also did not match as I had not restored any data to this partition for this test. I updated fstab for this one also while I was at it.
After rebooting to the new hard drive I was good to go. The /vmworld file system was available although I had to change permissions on it so I could copy my virtual box files back. Honestly I do not recall formatting this partition(?) I intentionally did NOT format the other 3 in this test. Perhaps sfdisk also copies the format - I will have to look that up.
So I now have a proven cold iron backup and restore process. Time to do some more experimenting with Ubuntu as I know how to recover from whatever disasters I might create.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.