LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Backup/restore and/or cloning of a hard drive Ubuntu 7.10 (https://www.linuxquestions.org/questions/ubuntu-63/backup-restore-and-or-cloning-of-a-hard-drive-ubuntu-7-10-a-616926/)

taylorkh 01-28-2008 02:09 PM

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???

Simon Bridge 01-28-2008 07:13 PM

Use free software - rsync say - to handle backups.
http://www.sanitarium.net/golug/rsync_backups.html
http://www.mikerubel.org/computers/rsync_snapshots/

http://www.informationweek.com/softw...urce/171200965

Grub Error 15 : "Error while parsing number"
This error is returned if GRUB was expecting to read a number and encountered bad data.
http://www.linuxquestions.org/questi...ror-15-431469/
... of course - changed UUIDs will do this too. AFAIK: UUIDs are stored on the drive. This means that dd method should preserve these.
http://ubuntuforums.org/showthread.php?t=599599

Have you tried simply:

dd in=/dev/sda of=/media/clone.img
dd in=/media/clone.img of=/dev/sda

You will only have a problem with fstab, so the easy workaround is to not use uuids in fstab.

taylorkh 02-01-2008 04:06 PM

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???

Regards,

Ken

taylorkh 02-02-2008 07:47 PM

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.

Cheers,

Ken


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