LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-21-2014, 10:21 AM   #1
zaldoor
LQ Newbie
 
Registered: Mar 2014
Posts: 8

Rep: Reputation: Disabled
Unable to boot after using dd to restore an image to a larger drive


I created an image using dd and restored it to the same size drive (64MB) with no issues, it boots fine into CE and our software works great.

When i try to restore the image to a larger drive (128MB), it doesn't boot.

From reading many articles online, dd should not have any problems restoring an image to a larger drive.

Here are the dd commands use to capture and restore:

Capture image:
dd if=/dev/hda conv=sync,noerror bs=64K | gzip -c > /trk/RDC_Images/hda.img.gz

Restore image:
gunzip -c /trk/RDC_Images/hda.img.gz | dd of=/dev/hda

When i restore to both drives 64MB or 128MB, they both completed the process successfully with no errors.

When i compare both drives using FDISK after they are imaged, all 3 partition are the same and the boot marker is on /dev/hda1. The only diffence between the 2, are the cylinder size, 64MB is 977 Cyl and the 128MB is 1954 cyl. Not sure if this would cause a problem for booting.

Has anyone experience the same problem? Any ideas why it won't boot on a larger drive?

Any help would be greatly appreciated.

Thanks,
Zaldoor
 
Old 03-21-2014, 01:25 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,938
Blog Entries: 13

Rep: Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968
Have you tried something like?
Code:
dd if=`gunzip -c /trk/RDC_Images/hda.img.gz` of=/dev/hda
I don't know how dd works by the way if you don't give it an if= argument.

To make it easier, I'd recommend not gzipping your file until you debug how to get it right. But you are correct that if you have a full byte by byte copy of an entire drive, you can write that to a larger drive using dd. The actual result will be that the physically larger drive will become the logical size of the smaller drive when the dd operation is done.

Last edited by rtmistler; 03-21-2014 at 01:27 PM.
 
Old 03-21-2014, 02:10 PM   #3
zaldoor
LQ Newbie
 
Registered: Mar 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
No i have not tried that yet. I will give it a try and let you know the results.
Thanks for the quick reply.

Zaldoor
 
Old 03-21-2014, 02:41 PM   #4
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by rtmistler View Post
Have you tried something like?
Code:
dd if=`gunzip -c /trk/RDC_Images/hda.img.gz` of=/dev/hda
I don't want to be a spoil-sport, but I don't think that will help - don't forget that the OP mentioned it worked fine as long as the target device is the same size as the image. To me, that is a clear indication that the general logic is right.

Quote:
Originally Posted by rtmistler View Post
I don't know how dd works by the way if you don't give it an if= argument.
Very simple: It takes its input from stdin instead, as any decent Unix tool does. Just issue a 'dd --help' and look at the explanation:

Code:
if=FILE         read from FILE instead of stdin
Quote:
Originally Posted by rtmistler View Post
To make it easier, I'd recommend not gzipping your file until you debug how to get it right.
Should do no harm unless you're going to mount the image or examine the file system inside it.

Quote:
Originally Posted by rtmistler View Post
But you are correct that if you have a full byte by byte copy of an entire drive, you can write that to a larger drive using dd. The actual result will be that the physically larger drive will become the logical size of the smaller drive when the dd operation is done.
Right. And you can resize the partition later or create an additional one to use the extra space.

[X] Doc CPU
 
Old 03-21-2014, 09:18 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,233

Rep: Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654
I'd agree that it is something to do with some issue between sizes. dd is a bit by bit so any reference to any size or unique name or such will/may fail.

How far does it boot? Any reference to where it stops?


It could even be that some protection scheme is in play. Some set file has to be at some place in order to boot or run.

I use G4U to clone some very old stuff that has protection on it. I think the original drive was 128M and some of the smallest drives we get are 8g so the image still thinks it is on 128m. I never use all those extra options on dd.

Last edited by jefro; 03-21-2014 at 09:21 PM.
 
Old 03-21-2014, 09:42 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,803

Rep: Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224
A drive as small as 64M could well have been in use with a BIOS that understood only C-H-S addressing, and the boot loader on that disk would have been set up accordingly. With only a single partition on the drive, your BIOS may be guessing (and yes, there is some guesswork involved) a geometry that differs from the original, and that would cause the C-H-S boot loader to fail.

Can you run "fdisk -l" on both drives and see if it reports the same geometry?

Oops. Looking back, I see that the drive has multiple partitions. Still, it's worth checking that the same geometry is detected.

Last edited by rknichols; 03-21-2014 at 09:45 PM. Reason: Add "Oops..."
 
Old 03-21-2014, 11:26 PM   #7
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,708

Rep: Reputation: 1673Reputation: 1673Reputation: 1673Reputation: 1673Reputation: 1673Reputation: 1673Reputation: 1673Reputation: 1673Reputation: 1673Reputation: 1673Reputation: 1673
Maybe with the same size drive the data is being put back at the right location on the drive for the bootloader to find boot files, but on the larger driver the data is being spread over a larger portion of the drive so that the bootloader isn't finding the boot files.
 
Old 03-22-2014, 12:38 AM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,803

Rep: Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224
Quote:
Originally Posted by colorpurple21859 View Post
Maybe with the same size drive the data is being put back at the right location on the drive for the bootloader to find boot files, but on the larger driver the data is being spread over a larger portion of the drive so that the bootloader isn't finding the boot files.
Restoring a full drive image to another drive puts everything back in exactly the same LBA locations.
 
Old 03-22-2014, 04:05 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,233

Rep: Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654Reputation: 3654
64MB is 977 Cyl and the 128MB is 1954 cyl.

Some of the adapters have a jumper to limit the cylinders. Thought it was 4K.

Guess there was some older limit or oddity of bios.


Some oddity of design difference.

OP, can you use a different clone app or tool than dd?

Last edited by jefro; 03-22-2014 at 04:09 PM.
 
Old 03-22-2014, 09:35 PM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,803

Rep: Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224Reputation: 2224
It's the number of heads and sectors per track that are important. Since the number of cylinders are in the same 2:1 ratio as the total size, odds are that the other parameters are the same for the two drives, but I can't imagine what else would cause the boot to fail.
 
Old 03-25-2014, 03:20 PM   #11
zaldoor
LQ Newbie
 
Registered: Mar 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
How far does it boot? Any reference to where it stops?
Once I bypass PXE boot, it tries to boot into windows CE and it stops there.
 
Old 03-25-2014, 03:22 PM   #12
zaldoor
LQ Newbie
 
Registered: Mar 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
Can you run "fdisk -l" on both drives and see if it reports the same geometry?
I did run fdisk -l and compared both hard drives 64MB and 128MB, both had the same geometry except for the Cylinders.

Last edited by zaldoor; 03-25-2014 at 03:24 PM.
 
Old 03-25-2014, 04:24 PM   #13
zaldoor
LQ Newbie
 
Registered: Mar 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
OP, can you use a different clone app or tool than dd?
Yes, we have been using Ghost in the past with no issues, but we are getting away from commercial licensing products and going open source. I am playing with Partition Saving, but i don't think it will do what I want it to do. In means of creating an image of /dev/hda and save it to a NFS share. Do you have any suggestions of another tool that I might be able to try?
 
Old 03-25-2014, 04:32 PM   #14
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,938
Blog Entries: 13

Rep: Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968Reputation: 4968
I'd recommend redoing that dd command without the conv= arguments.

From the manpage:

Quote:
noerror
continue after read errors

sync pad every input block with NULs to ibs-size; when used with block or unblock, pad with spaces rather than NULs
My interpretation is that the conv argument is causing padding to be added and using SPACES for that padding. And there's a default ibs-size, mine shows 512. Further, if you have a read error, it's continuing.

Try dd without gzip, just create an image file matching your disk size.

Then try dd of the .img file to the 64M and 128M disks and indicate if you still see problems.

Fine to gzip something, just since things aren't working; I'd remove the conv= and gzip complications.
 
Old 03-26-2014, 05:12 AM   #15
little_wolf_e
LQ Newbie
 
Registered: Mar 2012
Location: Suffolk, UK
Distribution: Fedora, Ubuntu
Posts: 18

Rep: Reputation: Disabled
Hi,

If the drive has a separate boot partition, perhaps you could try recreating a similar partition table on the new disk then copying the partitions separately. This might avoid geometry problems. This is something of a manual method, and as previous posters have said, an application designed to do such things may be a better direction to go.
 
  


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
[SOLVED] dd'ing a usb drive image to a larger usb drive? Abscissa256 Linux - General 3 01-03-2012 03:44 AM
Unable to restore a backup image to drive using Clonezilla justmehere Linux - Software 8 04-25-2011 02:05 AM
Using DD: Image file becomes larger than original SFS drive from SC101 rodyz Linux - Software 2 08-13-2009 04:41 PM
Copy Image of System to larger drive villumanati Fedora 3 03-16-2009 10:57 PM
Drive Failure - Restore from drive/partition image? dkuntz Linux - General 3 12-02-2006 02:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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