LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-07-2004, 02:20 PM   #1
dravya
LQ Newbie
 
Registered: May 2004
Posts: 23

Rep: Reputation: 15
Question Cloning a / and swap partition for Red Hat 9


Hi people,

I want to clone my " / "and "swap" partitions for a Red Hat 9 installation, in order to transfer the image onto a new system that has a 1 GB compact flash memory. The idea is to fit the image within 1 GB of space. The current installation size is 870 MB.

I tried out the software from partimage.org . This would work just fine, except it cannot make an image of a "swap" partition. Is there anything out there can clone a "swap" partition as well as "/ " partition.

Urgently needed.

Thanking you in advance.

Dravya
 
Old 05-07-2004, 02:34 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
I'm not really sure why you would want to image a swap partition - it will not hold any data across reboots.
 
Old 05-07-2004, 03:38 PM   #3
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
If you use sfdisk to backup the partition table, that will make the partition structure on the new drive when you restore it. Here are the commands...

Save the ENTIRE PARTITION TABLE to a file using sfdisk.
sfdisk d /dev/hda > /mnt/images/backup/partfile

Restore that partition table from files to the new hard drive using the command:
sfdisk /dev/hda < /mnt/images/backup/partfile

I happen to have a script which I use from a rescue cdrom which automates the restore process.....


Bootup with the rescue cd and run the clone script to restore the images to your new hard drive.

Code:
#!/bin/bash
#
clear
echo
echo "********************************************************************"
echo "     Caution!!!     This program will erase your hard drive"
echo
echo -n "                Do you want to proceed (Y/N)?"
read answer
if test "$answer" != "Y" -a "$answer" != "y";
then exit 0;
fi
#
clear
#
#Erase the old boot sector
dd if=/dev/zero if=/dev/hda bs=512 count=1
#
#Restore the partition table from file
sfdisk /dev/hda < /mnt/images/backup/partfile
#
#Restore the MBR from file
#dd if=/mnt/images/backup/mbrfile of=/dev/hda bs=512 count=1
clear
#
#Restore the images with Partimage
partimage restore -b -z2 -f3 /dev/hda1 /mnt/images/backup/windows.000
#
partimage restore -b -z2 -f3 /dev/hda2 /mnt/images/backup/linux.000
#
clear
echo "Image restore is complete"
echo
#
#

Last edited by homey; 05-07-2004 at 03:40 PM.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cloning a drive in Red Hat 8 mustang05 Linux - Software 1 08-23-2004 07:46 PM
how to clone a Red Hat 9 system (870 MB) with all the partitions (/ and swap) dravya Linux - General 3 05-07-2004 06:42 PM
How do I partition so Red Hat and SuSE share the same swap file. sjia Linux - Newbie 3 01-31-2004 08:26 AM
Red hat not finding swap space jza Linux - General 2 07-28-2003 07:57 PM
Red hat 8.0 partition questions Chopstick Linux - General 1 07-16-2003 08:55 AM


All times are GMT -5. The time now is 07:44 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