LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 08-26-2007, 07:54 AM   #1
voger
Member
 
Registered: Oct 2005
Distribution: Arch
Posts: 68

Rep: Reputation: 15
Clone Dos partition.


Hi everyone

I have a hard disk 40GB which has a ~2GB DOS partition in it. What I want to do is to clone that partition in an image file somewhere in my PC (preferably compressed) and later restore that image in some other disk and use it. I want to backup that drive and restore in case of a hard disk crash.

From what I read dd works if both disks are identical but there is no guarantee for that in my case. The target disk could be smaller or larger in size.

I also am aware of G4U and G4L but as I understand it they require one FTP server to be set up and that adds too much complication in my task.

Essentially what I want to do is

1. Load the image in the disk
2. Modify one file in the disk
3. Plug the disk in the broken machine
4. Get out of there

Is there any way to copy only that partition + MBR + Partition table and then restore only these?
 
Old 08-26-2007, 08:15 AM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
G4U and G4L don't require an FTP server, that is just one way to use them (and probably the most efficient). They can also make local images.

That said, both G4L and G4U are simply wrappers for "dd" itself. So your results when using one of those is going to be the same as if you just used dd. Neither product guarantees that you will be able to use your images on anything other than an identical disk.

If you want to be positive that you can use the backup on any disk, then the best thing to do is just tar and compress the entire file system itself, rather than actually making an image of it. Something like:

Code:
mount -t msdos /dev/hda2 /mnt/dos
tar cvf /tmp/dosbackup.tar /mnt/dos/*
gzip -c 9 /tmp/dosbackup.tar > /tmp/dosbackup.tar.gz
Then it is just a matter of expanding that archive onto the destination disk if you needed to restore it. With this method, the physical properties of the volume you are restoring to are inconsequential, since the backup never even took them into account.

You could even use dd to backup the MBR and insert that into the compressed image as a regular file.

Code:
dd if=/dev/hda of=/tmp/mbr.bak bs=512 count=1
Alternately, you could make an image of the single partition itself rather than the entire disk. For that I would suggest Partimage. With this, you are only making images of specific partitions, so the only thing that matters is the partition size itself. There is no difference between a 2 GB partition on a 20 GB drive or a 120 GB drive, the partition size is still going to be the same. It sounds like this might actually work well for what you are trying to do.

Do note that Partimage (to my knowledge) does not have the capability of backing up MBRs since it is not in the business of full drive backups. To backup the MBR you could use the dd line I gave above, and then restore the MBR from the live CD containing Partimage before rebooting.

Last edited by MS3FGX; 08-26-2007 at 08:16 AM.
 
Old 08-26-2007, 04:03 PM   #3
masterclassic
Member
 
Registered: Jun 2007
Distribution: Knoppix, antiX
Posts: 252

Rep: Reputation: 73
There is also the "clonezilla" program, that is included in the "gparted-clonezilla" liveCD, about 130MB ISO (not just the "Gparted" liveCD, about 50MB ISO ).
It can clone many partition types (dos and Linux).
 
  


Reply



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
Using dd to clone an NTFS partition from a strange partition table jgombos Linux - Software 2 10-26-2006 12:10 AM
Clone Slackware to New Partition? Freedom Seeker Slackware 9 08-30-2006 07:12 AM
can i use dd to clone a partition? dr_zayus69 Linux - Software 1 01-25-2005 04:57 PM
CLone/Copy a partition Tyir Linux - General 12 01-28-2004 09:02 AM
How do clone Linux partition? samxiao Linux - Software 5 12-24-2003 07:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:44 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration