Jump to content

df -h reporting incorrect partition size


Recommended Posts

I cloned my gentoo install using dd, going from smaller partitions to larger. dd probably wasn't the best way to go but i did it that way (simple dd if=/dev/hdXX of=/dev/hdXX), and now i'm getting an issue with df -h reporting the wrong partition sizes.

see:

mark@einsiedler ~ $ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hdc1             9.9G  6.7G  3.3G  68% /
/dev/hdc2             5.5G  3.5G  2.1G  63% /usr
/dev/hdc3              30G   18G   13G  59% /home/mark

where as, fdisk (and gparted) show it correctly:

   Device Boot      Start         End      Blocks   Id  System
/dev/hdc1               1        1912    15358108+  83  Linux
/dev/hdc2            1913        3824    15358140   83  Linux
/dev/hdc3            3825       10199    51207187+  83  Linux

as you can see it should be 2 15GB partitions and one 50GB partition. i tried using w in fdisk to have it write the table, and rebooted, but df -h is still reporting incorrectly. It seems this is an issue with linux reporting the wrong sizes to itself, but I'm not sure where I can find this information or how to reset it. Any ideas?

Link to comment
Share on other sites

Uh.. a very difficult one imho.... Maybe you need to change your /proc/partitions from a chroot environment and run fdisk afterwards... just guessing. I will do some researches, maybe I find a solution.

Link to comment
Share on other sites

What file system are you using? Are the hd's that you dd'd the same size? If there not, your moving block for block and that will hose it up or atelast not be a good method. dd is best for same drive situations.

 

You could blow them out again format and use rsync and see if that helps.

Link to comment
Share on other sites

i was going from a 80GB drive to a 200GB drive, which is probably why using dd screwed it all up. I decided to just clean the partitions and then used a boot disk to do cp -pdR /mnt/gentoo /mnt/gentoo2 and it worked out fine.

Link to comment
Share on other sites

i was going from a 80GB drive to a 200GB drive, which is probably why using dd screwed it all up.  I decided to just clean the partitions and then used a boot disk to do cp -pdR /mnt/gentoo /mnt/gentoo2 and it worked out  fine.

 

dd replicates the partition (as you've just learnt)

 

if you dd from a 10gb partition to a 20gb partition it will re-write the partition table and format the new partition to 10gb

Link to comment
Share on other sites

  • 4 weeks later...

As the above post states it's a dd thing. Whenever you dd from a smaller partition to a larger partition you wind up with that problem. If you still have your data on the smaller partitions, reformat the large partitions and transfer the data to the large partitions using tar. It's best to use a livecd like knoppix to do that. Make sure both the small and large partitions are mounted read/write within knoppix; open a console, su to root, cd to the mount point of the small partition you want to transfer and then run:

 

# tar -cf - . | (cd <mount point of large partition>; tar -xvf -)

 

rinse and repeat for each partition you want to transfer. Note, those puctuation marks in the above command are very important; don't forget the "." or "-"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...