LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   df showing wrong output (https://www.linuxquestions.org/questions/slackware-14/df-showing-wrong-output-264118/)

samac 12-08-2004 01:40 PM

df showing wrong output
 
I just upgraded my hard drive.

I fdisked the partitions, so they were the same as the existing drive, only bigger, created filesystems on them and then used dd to copy over the information.

I then swapped the drive cables, booted with a rescue disk, used lilo to put the MBR in place and rebooted.

All is well, a perfect upgrade, well almost.

When I run df the results are from the old drive, which is currently not mounted. Where does df get its information from, can this file be updated.

It's annoying to have df tell me that I have a 40gb drive when dmesg tell me the correct result of 160gb.

Please help.

muah 12-08-2004 02:12 PM

I m not sure if its possible but maybe you have recreated the partition when you used dd.
Does fdisk refer correct partition size now?

kilgoretrout 12-08-2004 02:14 PM

The problem is using the dd command to transfer the files. dd will create an exact image of the original partition on the new larger partition but the result will be that linux will see the new partition just like the old partition, i.e dd created a block device on the new partition identical to the old and the extra space will not be detected. The dd created block device lives inside the new partition but cannot access the extra space. See this link for how to use the cp command to copy the files from one partition over to another preserving all permissions/links, etc:

http://lug.mtu.edu/lists/lug-l-0302/msg00051.html

that should give the result you want.

samac 12-08-2004 02:16 PM

No df shows old information. My concern is that the system might think it if full, when it is really empty.

Cedrik 12-08-2004 02:19 PM

What option did you give to dd command ? I would think it did fill the drive with 0's for remaining
empty space. To duplicate a partition into another partition with different size I would rather use
tool like tar.

samac 12-08-2004 02:20 PM

Snip

The problem is using the dd command to transfer the files. dd will create an exact image of the original partition on the new larger partition but the result will be that linux will see the new partition just like the old partition, i.e dd created a block device on the new partition identical to the old and the extra space will not be detected. The dd created block device lives inside the new partition but cannot access the extra space.

Snip


So I am basically scr***d, with regard to the extra space.

Any suggestions about how to change the block size on the fly, or indeed any suggestions.

samac 12-08-2004 02:22 PM

snip

What option did you give to dd command ? I would think it did fill the drive with 0's for remaining
empty space. To duplicate a partition into another partition with different size I would rather use
tool like tar.

snip

dd if=/dev/hda1 of=/dev/hdc1 bs=1024

tar, hmm explain.

kilgoretrout 12-08-2004 02:26 PM

Your not screwed if you still have your old hd with the data on it. Even if you deleted it, you can copy what you have on your new drive back to the old, delete your partitions on your new drive, repartition and reformat then use the cp command like I indicated in my edited post to transfer the files to your new hard drive. All should be well then.

Cedrik 12-08-2004 02:29 PM

I use tar like this to copy a mounted partition to another :
Code:

cd /mnt/source_partition
tar cf - . | (cd /mnt/destination_partition; tar xvf -)

I had problem with cp command, that's why I use tar

samac 12-08-2004 02:38 PM

Thanks kilgoretrout, cedrik

I have all the info, now on hdc, I will re-format and either cp or tar across.

thanks again

Samac


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