LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - General
User Name
Password
Linux - General This 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

Tags used in this thread
Popular LQ Tags , ,

Reply
 
Thread Tools
Old 12-04-2007, 05:43 PM   #1
pentalive
Member
 
Registered: Jun 2005
Location: Sacramento, CA
Distribution: Many, Old and New
Posts: 121
Thanked: 0
Quick DD unequal size drive question


[Log in to get rid of this advertisement]
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 05:45 PM.. Reason: clarifacation
pentalive is offline  
Tag This Post , ,
Reply With Quote
Old 12-04-2007, 06:00 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: atop the Blue Ridge
Distribution: Debian Lenny, CentOS 5.2
Posts: 7,250
Thanked: 31
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
jailbait is offline     Reply With Quote
Old 12-04-2007, 06:54 PM   #3
pentalive
Member
 
Registered: Jun 2005
Location: Sacramento, CA
Distribution: Many, Old and New
Posts: 121
Thanked: 0

Original Poster
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?
pentalive is offline     Reply With Quote
Old 12-04-2007, 07:07 PM   #4
pixellany
Moderator
 
Registered: Nov 2005
Location: Pasadena, CA
Distribution: Arch
Posts: 13,165
Thanked: 285
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.
pixellany is offline     Reply With Quote
Old 12-04-2007, 07:14 PM   #5
chadl
Member
 
Registered: Sep 2005
Location: US
Distribution: Gentoo AMD64 Testing
Posts: 129
Thanked: 0
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.
chadl is offline     Reply With Quote
Old 12-04-2007, 07:34 PM   #6
syg00
Guru
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 6,908
Thanked: 165
Nuts.
Create new partitions on the big disk, and copy ("dd" if you insist) each partition in turn.
syg00 is offline     Reply With Quote
Old 06-30-2009, 12:31 PM   #7
boutch55555
LQ Newbie
 
Registered: Jun 2009
Posts: 1
Thanked: 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
boutch55555 is offline     Reply With Quote
Thanked by:
Old 06-30-2009, 03:09 PM   #8
pentalive
Member
 
Registered: Jun 2005
Location: Sacramento, CA
Distribution: Many, Old and New
Posts: 121
Thanked: 0

Original Poster
That's it

Thanks everyone for your answers.

Pentalive.
pentalive is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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


All times are GMT -5. The time now is 03:04 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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration