LinuxQuestions.org
Visit Jeremy's Blog.
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 12-04-2007, 04:43 PM   #1
pentalive
Member
 
Registered: Jun 2005
Location: Sacramento, CA
Distribution: Many, Old and New
Posts: 124

Rep: Reputation: 15
Quick DD unequal size drive question


dd if={40gb hard drive} of={120gb hard drive}

What happens?

I suppose the 120gb hd looks like a 40gb hard drive afterward. If so is there any way to get back the lost disk space?

(this in a more recent distro than RedHat 7.3)

Last edited by pentalive; 12-04-2007 at 04:45 PM. Reason: clarifacation
 
Old 12-04-2007, 05:00 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,391

Rep: Reputation: 583Reputation: 583Reputation: 583Reputation: 583Reputation: 583Reputation: 583
Quote:
Originally Posted by pentalive View Post
dd if={40gb hard drive} of={120gb hard drive}

What happens?

I suppose the 120gb hd looks like a 40gb hard drive afterward. If so is there any way to get back the lost disk space?

(this in a more recent distro than RedHat 7.3)
You might be able to make the lost space usable by changing the partition table.

---------------------
Steve Stites
 
Old 12-04-2007, 05:54 PM   #3
pentalive
Member
 
Registered: Jun 2005
Location: Sacramento, CA
Distribution: Many, Old and New
Posts: 124

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jailbait View Post
You might be able to make the lost space usable by changing the partition table.

---------------------
Steve Stites
Is there a linux tool that will grovel through the disk drive and create a partition table?
 
Old 12-04-2007, 06:07 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
dd copies everything literally.......

If you copy the whole drive (if=/dev/hda), then it copies the MBR, partition tables, and all partitions. Going from 40 to 120, you will wind up with an image of your 40GB drive at the front of the 120. I assume you can then resize and/or create new partitions to fill the excess space.

When you clone just a partition (if=/dev/hdaX), then that's all you get. I assume that you have to copy to a target partition which is at least big enough.
 
Old 12-04-2007, 06:14 PM   #5
chadl
Member
 
Registered: Sep 2005
Location: US
Distribution: Gentoo AMD64 Testing
Posts: 129

Rep: Reputation: 16
fdisk can increase the size of the partition, but you need to know exactly how big the disk is to be able to tell it (because it only knows what is on the partition table, that is from the small disk). It is very easy to screw everything up beyond repair while doing this. Read the man page for more info.
After that is done resize2fs (or the tool for your fs type) can increase the size of the file system to match that of the new partition.
 
Old 12-04-2007, 06:34 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,414

Rep: Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197Reputation: 4197
Nuts.
Create new partitions on the big disk, and copy ("dd" if you insist) each partition in turn.
 
Old 06-30-2009, 11:31 AM   #7
boutch55555
LQ Newbie
 
Registered: Jun 2009
Posts: 1

Rep: Reputation: 1
The easy way

Since this is the only thread I found on the dd resizing, I will add my solution :
Tested with ext2 on ubuntu 8.10 with 4gb (almost full) sd card to 8gb sdhc card.
I simply opened gparted, reduced the size of the partition of about 10mb (gparted was saying I had a 7.x gb partition almost full), and then expanded it to full size again (gparted now says I got a 7.x gb partition with 4gb free, df tells me the same). Took 3 minutes

hope this helps
 
Old 06-30-2009, 02:09 PM   #8
pentalive
Member
 
Registered: Jun 2005
Location: Sacramento, CA
Distribution: Many, Old and New
Posts: 124

Original Poster
Rep: Reputation: 15
That's it

Thanks everyone for your answers.

Pentalive.
 
Old 04-30-2010, 12:49 AM   #9
myjess
LQ Newbie
 
Registered: Apr 2010
Posts: 11

Rep: Reputation: 0
Quote:
Originally Posted by boutch55555 View Post
Since this is the only thread I found on the dd resizing, I will add my solution :
Tested with ext2 on ubuntu 8.10 with 4gb (almost full) sd card to 8gb sdhc card.
I simply opened gparted, reduced the size of the partition of about 10mb (gparted was saying I had a 7.x gb partition almost full), and then expanded it to full size again (gparted now says I got a 7.x gb partition with 4gb free, df tells me the same). Took 3 minutes

hope this helps
Now that is just lovely. Exactly what I needed when booted off the ubuntu live cd and installed gparted to fix a dd copy.
It's 6 months since since thread but I just gotta thank you.
 
  


Reply

Tags
dd


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
Quick Directory Size Question pxumsgdxpcvjm Linux - Newbie 7 03-31-2007 10:55 PM
Quick Hard Drive Usage question DragonM15 Linux - Hardware 12 03-21-2007 12:14 AM
Unequal load balancing on two interfaces mpeg4codec Linux - Networking 3 08-22-2005 07:00 PM
Just a quick question reguarding installing a hard drive. reesee Linux - Newbie 1 02-02-2004 04:19 AM
External USB hard drive: quick question infidel Linux - Hardware 6 01-19-2004 05:08 PM

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

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