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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
10-07-2008, 07:27 PM
|
#1
|
Member
Registered: Feb 2003
Distribution: Gentoo, Debian, Openslug, Slackware
Posts: 46
Rep:
|
Using dd for backup screws up drive geometry
I copied an entire disk to a larger one using:
dd if=/dev/source of=image
dd if=image of=/dev/target
The source drive was 40gigs, the target drive 110gigs. Everything seems to have worked, but now the drive geometry on the target drive reads the same as the source drive. Is there any way to recover the unused space?
|
|
|
10-08-2008, 01:58 AM
|
#2
|
Member
Registered: Jul 2005
Location: Mission TX
Distribution: Ubuntu, Mint
Posts: 122
Rep:
|
Drive geometry
Quote:
Originally Posted by DeadlyMuffin
I copied an entire disk to a larger one using:
dd if=/dev/source of=image
dd if=image of=/dev/target
The source drive was 40gigs, the target drive 110gigs. Everything seems to have worked, but now the drive geometry on the target drive reads the same as the source drive. Is there any way to recover the unused space?
|
You should be able to use parted to stretch the current partions and/or create an additional partition. Since you will be making major changes to your hard drive you need to be SuperUser or use sudo parted and follow the menu.
Last edited by FewClues; 10-08-2008 at 01:59 AM.
|
|
|
10-08-2008, 11:30 AM
|
#3
|
Member
Registered: Feb 2003
Distribution: Gentoo, Debian, Openslug, Slackware
Posts: 46
Original Poster
Rep:
|
Really? Fdisk and cfdisk both show the drive as a 40 gig (which it isn't). Would parted be able to figure it out?
|
|
|
10-08-2008, 12:05 PM
|
#4
|
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Fedora40
Posts: 6,153
|
Using dd like that means you have rewritten the partition table on your 110G disk, so it now thinks it is a 40G disk.
What you should have done was to create a 40G + a bit for safety partition on the 110G disk and then dd'd the original drive to that partition
eg
Code:
dd if=/dev/hda of=/dev/hdc1
Where /dev/hda is your 40G disk and /dev/hdc1 is the slightly bigger than 40G partition on your 110G disk.
|
|
|
10-08-2008, 02:25 PM
|
#5
|
Member
Registered: Feb 2003
Distribution: Gentoo, Debian, Openslug, Slackware
Posts: 46
Original Poster
Rep:
|
Quote:
Originally Posted by tredegar
Using dd like that means you have rewritten the partition table on your 110G disk, so it now thinks it is a 40G disk.
What you should have done was to create a 40G + a bit for safety partition on the 110G disk and then dd'd the original drive to that partition
eg
Code:
dd if=/dev/hda of=/dev/hdc1
Where /dev/hda is your 40G disk and /dev/hdc1 is the slightly bigger than 40G partition on your 110G disk.
|
Yup, I realized that once I started doing some digging, but I'm afraid it's too late to go back. What I'm looking for is how to fix the drive as it is now.
|
|
|
10-08-2008, 02:59 PM
|
#6
|
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Fedora40
Posts: 6,153
|
Quote:
What I'm looking for is how to fix the drive as it is now.
|
Fix which drive?
I assume the original 40G is still working OK. So you don't need the (backup?) copy right now.
In which case plug in the 110GB drive and repartition it (Delete all partitions, create new ones, write the changes to it).
Then do the dd again to the correctly sized (and add a bit!) partition you created earlier, with the benefit of hindsight.
|
|
|
10-08-2008, 03:16 PM
|
#7
|
Member
Registered: Feb 2003
Distribution: Gentoo, Debian, Openslug, Slackware
Posts: 46
Original Poster
Rep:
|
Quite right, the 40 gig drive is fine, but the 110 gig drive reads as 40 gigs in fdisk, so even if I wipe the partitions and make a new one, it will be a 40 gig partition.
|
|
|
10-08-2008, 07:40 PM
|
#8
|
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Fedora40
Posts: 6,153
|
Quote:
but the 110 gig drive reads as 40 gigs in fdisk, so even if I wipe the partitions and make a new one, it will be a 40 gig partition.
|
No, it won't. You have missed the point.
Just fdisk the 110GB again. Delete all the partitions. Write these changes to the disk.
Then create new partitions as you wish.
You have not understood the difference between
/dev/hdx and /dev/hdx1 or /dev/hdx2 , the first and second partitions on the device /dev/hdx
Try again.
|
|
|
10-08-2008, 08:35 PM
|
#9
|
Member
Registered: Feb 2003
Distribution: Gentoo, Debian, Openslug, Slackware
Posts: 46
Original Poster
Rep:
|
Actually, I think you're misunderstanding what I'm saying.
I do understand the difference between copying a single partition and copying the whole disk. In retrospect, I should've copied it partition by partition. Hindsight is always 20-20.
The problem now is that every tool I use sees the 110 gig drive as a 40 gig drive. This includes fdisk. If I manually enter the correct heads/sectors/cylinders in fdisk and force it to create a partition that actually fits on the disk no utilities accept it, and everything complains that the partition extends beyond the end of the disk.
I don't care about the partitions right now, what I want to do is get my 110 recognized as 110 gigs. I've tried deleting the old partitions, adding new ones, whatever, it doesn't seem to take.
Irritatingly enough even writing changes to the number of heads/sectors/cylinders in fdisk doesn't seem to take.
|
|
|
10-08-2008, 08:41 PM
|
#10
|
Member
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247
Rep:
|
If you don't care about your partitions or anything else on that HDD, you could just delete your HDD's partition table with:
Code:
dd if=/dev/zero of=/dev/hdc bs=512 count=1
Or replace hdc with whatever is your HDD. The above command will delete the entire MBR (Master Boot Record) and make your HDD appear like it has never been formatted before. That should do the trick of getting it recognized as 110 GB again. Let me know how it goes.
|
|
|
10-09-2008, 07:53 AM
|
#11
|
Senior Member
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,637
Rep:
|
To learn about dd there is this
http://www.linuxquestions.org/questi...ommand-366442/
and follow the link to the newer thread. There use the search-thread-function and search for MBR or any key word you deem of interest. There is also lots to learn in the follow up posts.
|
|
|
10-09-2008, 10:26 AM
|
#12
|
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Fedora40
Posts: 6,153
|
Quote:
The problem now is that every tool I use sees the 110 gig drive as a 40 gig drive. This includes fdisk. If I manually enter the correct heads/sectors/cylinders in fdisk and force it to create a partition that actually fits on the disk no utilities accept it, and everything complains that the partition extends beyond the end of the disk.
|
This is very strange behaviour. fdisk - delete the partition(s) - create partitions always works for me.
No offense intended, but I suppose you have made absolutely sure you have identified your disks correctly?
If necessary by unplugging one, reading the label, and re-testing the one that is still plugged in?
|
|
|
10-09-2008, 11:37 AM
|
#13
|
Member
Registered: Feb 2003
Distribution: Gentoo, Debian, Openslug, Slackware
Posts: 46
Original Poster
Rep:
|
Yep, I'm certain it's the same drive. I think I may be SOL on this one.
|
|
|
10-09-2008, 12:36 PM
|
#14
|
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Fedora40
Posts: 6,153
|
Did you try zeroing out the drive as CJS suggested? Please be very careful that you are choosing the correct device, and remember, you are zeroing the disk, not a partition.
Once you have done that, could you please post the output of
With both drives attached (you'll need to be root).
|
|
|
10-09-2008, 01:31 PM
|
#15
|
Member
Registered: Feb 2003
Distribution: Gentoo, Debian, Openslug, Slackware
Posts: 46
Original Poster
Rep:
|
Zeroing the partition table deletes the partitions, but the drive still reads as the wrong size.
I don't have the original 40 gig drive installed, this is the output for the large drive (it's actually a 160 not a 110, I was mistaken)
fdisk -l /dev/sda
Disk /dev/sda: 38.5 GB, 38502535680 bytes
64 heads, 32 sectors/track, 36718 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id
This was after zeroing it. The irritating part is, I know what the correct heads/sectors/cylinders should be, but when I change them in fdisk they change right back as soon as I exit.
|
|
|
All times are GMT -5. The time now is 09:05 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|