LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices

Reply
 
Search this Thread
Old 12-18-2006, 06:51 PM   #1
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6 on my desktop, Ubuntu 12.04 LTS on my server, Ubuntu 12.04 on my netbook and the wife's PC
Posts: 1,192

Rep: Reputation: 96
Thumbs up Sledge hammer approach to backup AND RESTORE Fedora Core 5


For many years I have used Ghost (Binary Research, Norton, Symantec) to perform cold backups of Windows and Linux OS partitions. Works well and has saved my butt on several occasions. However, somewhere between FC2 and FC4 this option went away. Ghost does not do LVMs (logical volumes) nor does it like something which changed in the ext3 file system. Same for True Image, g4l and partimage. I am reduced to the option of doing a bit for bit copy to another disk. Slow and not very flexible. With some helpful advice from this forum, some research and experimentation I arrived at the following solution.

First LVMs had to go. I do not need that flexibility on a productivity PC sort of installation. This may be specified during the install. However, something in the ext3 file system was still causing a problem. I guessed that this might be the allocation of inodes to allow the file system to be dynamically expanded. Again this was something I do not need so I decided to blow away this feature as well. Here is the step by step...

First I partitioned the hard drive the old fashion way - with fdisk. I booted the PC with a Fedora rescue CD and issued the fdisk command. For those of you not familiar with fdisk, here is the gory detail.

fdisk /dev/hda (invokes the program to work on the first disk)
p (prints the existing partition table)
d (deletes a partition - AND THE DATA!!!)
1 (delete partition 1, did the same for all partitions, now had a clean drive)
w (writes the changes - no going back from here)
p (confirmed that the drive was clear)

n (create a new partition)
p (make it a "primary" partition)
1 (I am making the first partition)
<Enter> (accept the first cylinder as the starting point)
+100M (make the partition 100 MB)

I did the same for 3 more partitions 10GB, 1MB and the rest of the 40 GB drive. Then a little advanced magic:

a <Enter> 1 <Enter> (toggle the boot flag on the first partition)
t <Enter> 3 <Enter> 82 <Enter> (change partition 3 type to Linux Swap)
p (lets see what we have - actually these numbers are fudged as I did not save the fdisk data from the first drive)

Disk /dev/hda: 40.0 GB, 40026361856 bytes
255 heads, 63 sectors/track, 4729 cylinders
Units = cylinders of 16065 * 512 = 4225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 1259 10008495 83 Linux
/dev/hda3 1260 1384 1004062+ 82 Linux swap / Solaris
/dev/hda4 1385 4792 18045488+ 83 Linux

w (make it so!)
q (quit playing with fdisk)

So now the disk is partitioned as I want it. Time to create the file systems w/o LVMs nor those pesky resize inodes. The commands are as follows:

mkfs.ext3 -L /boot /dev/hda1 -O ^resize_inode (- capital Oh, not zero)
mkfs.ext3 -L / /dev/hda2 -O ^resize_inode
mkfs.ext3 -L /home /dev/hda4 -O ^resize_inode

There is no need to do anything with the swap partition at this point. I now have

/boot - 100 MB
/ - 10 GB
swap - 1 GB
/home - about 27 GB

So now I do a rather basic Fedora Core 5 install with just a couple of exceptions. I tell the install to use the partitions/filesystems I have and NOT to format anything except for the swap partition. Once everything was humming the way I wanted, it was time to do a backup.

I booted the PC from the g4l v0.21 CD (I downloaded the ISO from http://sourceforge.net/projects/g4l and burned to a CD - instructions are on the project page). This CD has partimage wrapped in a nice menu system. In invoked g4l and chose "File Mode" from the main menu.

"Select Partition" - I chose /dev/hda4
"Launch client" and I selected hda1 as the partition to save and /mnt/local/hda1bkup.gz as the file to backup to (this is on /dev/hda4 which was selected above) I then performed the backup. I did the same with /hda2. No need to backup the swap partition. Now I have 2 partitions down.

I rebooted the PC to Fedora Core 5 so that I could snag the 2 partimage files from /dev/hda4 which is my /home file system. I did this with Winscp to my XP box - FOR SHAME :-( Two more critical pieces were backed up (after su to root and mounting /def/fd0 as /floppy). The mbr or "master boot record" thusly:

dd if=/dev/sda of=/floppy/backup-hda.mbr count=1 bs=512

and the partition layout as follows:

sfdisk -d /dev/sda > /floppy/backup-hda.sf

These files were also transferred to the XP box. I deleted the backup files from /home and again booted from the g4l CD. This time I backed up hda4 to hda2. This file was also transferred to the XP box and all 5 backup files were burned to a DVD. Now I had my system backed up. The big question - could I restore it???

The chance came when my new 80GB SATA drives arrived by UPS. They are installed in removable trays so I can change the OS without opening the box (and not having to mess with dual booting etc.) So here I go...

Pull the original 40 GB drive and make belive it is dead. Install the 80 GB drive. Boot from the Fedora rescue CD (the g4l CD is missing a couple of things I need).

Step 1 - restore the partition layout
mkdir /floppy
mount /dev/fd0 /floppy
sfdisk /dev/sda < /floppy/backup-sda.sf

Step 2 - restore the mbr
dd if=/floppy/backup-sda.mbr of=/dev/sda

Step 3 - lets see what we have
fdisk /dev/sda
p (print the partiton table - looks something like this)

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1259 10008495 83 Linux
/dev/sda3 1260 1384 1004062+ 82 Linux swap / Solaris
/dev/sda4 1385 4792 18045488+ 83 Linux

Fine, except that I have lost 40 GB :-( so its time to tweak a little.

d <Enter> 4 <Enter> (delete 4th partition)
n <Enter> e <Enter> 4 <Enter> <Enter> <Enter> (create an EXTEDED partition to use all of the disk left after the 3rd partition)
n <Enter> 5 <Enter> <Enter> 4792 <Enter> (create the first partition WITHIN the extended partition - make it the same size as the partition which was used for /home on the original disk)
n <Enter> 5 <Enter> <Enter> <Enter> (make another partition within the extended partition to use up the rest of the disk - I want this for backup use in the future)
p <Enter> (and we have)

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1259 10008495 83 Linux
/dev/sda3 1260 1384 1004062+ 82 Linux swap / Solaris
/dev/sda4 1385 9729 67031212+ 5 Extended
/dev/sda5 1385 5000 29045488+ 83 Linux
/dev/sda6 5001 9729 37985661 83 Linux

w <Enter> (make it so)
q <Enter> (enough of this fdisk fun)

Step 4 - Get hold of the backup files and restore the partitions. Unfortunately I cannot access a DVD after booting from a CD. I have posted a question about this - there is probably an answer - but for now (yes this is a little ugly)...

I will use my backup partition! So I create a file system on it:
mkfs.ext3 -L /backup /dev/sda6 -O ^resize_inode
mkdir /backup
mount /dev/sda6 /backup

and to get the files I put them on my Linux server and fetched them with scp:

cd /backup
scp ken@192.168.0.110:/data2/taylor9/hda1bkup1.gz.000 etc.

So now I have the partitions made on my new drive and the partimage backup files copied to the new backup partition on the drive. I now boot from the g4l CD and invoke g4l. I again choose "File Mode" and navigate the menus to select sda6 as my source and then one by one I restore sda1, sda2 and sda5. Recall that the data for /home used to be on hda4. The extended partition on the new drive, sda4, is simply a place keeper and no data is store on it. The file hda4bkup.gz gets restored to sda5.

I popped out the g4l CD and rebooted. Amazing! I am now running FC5 from my new hard drive. A restore from cold iron success!!!

So now to get into my normal backup routine:

1 - backup the mbr (done one time from FC5)
mount /dev/sda6 /backup
dd if=/dev/sda of=/backup/backup-sda.mbr count=1 bs=512

2 - backup the partition table (done one time from FC5)
sfdisk -d /dev/sda > backup-sda.sf

Save these files to a CD, DVD, floppy disk etc.

3 - backup partitions sda1, sda2, sda5 to sda6 (periodically boot from the g4l CD and use g4l/partimage - ideally BEFORE making any drastic changes to the OS :-) The OS can be quickly restored from the files on sda6 which represent the most current state.

That's my story and I'm sticking to it. Hope you find something helpful in this dissertation. Please feel free to contact me if any of this rambling monograph is confusing (or wrong).

Regards,

Ken

p.s. and N.B. partimage will NOT restore to a partition smaller than the one from which it backed up. It will not tell you of this offense, it will simply drop you back to the prior menu. If in doubt, add a couple of MB to the new partition.
 
Old 12-18-2006, 07:11 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,462
Blog Entries: 54

Rep: Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899Reputation: 2899
Good info. Should be in the LQ Articles section.
 
Old 12-19-2006, 05:32 PM   #3
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6 on my desktop, Ubuntu 12.04 LTS on my server, Ubuntu 12.04 on my netbook and the wife's PC
Posts: 1,192

Original Poster
Rep: Reputation: 96
Thanks unSpawn. Perhaps after a little peer review here it can get administratively moved to the Articles section.

Ken
 
  


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
Tape backup on Fedora Core 5 triley Linux - General 6 08-17-2006 02:21 PM
Is there a System Restore Utility for Fedora Core 5? YAOMK Fedora 10 05-19-2006 04:33 PM
Backup for Fedora Core 3? lennysokol Linux - General 5 02-26-2005 07:28 PM
backup approach ulaoulao Linux - Software 0 10-05-2004 07:03 AM
backup via Win2K from Fedora Core 2 rporter1980 Fedora 0 06-19-2004 05:54 AM


All times are GMT -5. The time now is 06:36 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration