LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-08-2008, 05:54 AM   #1
pobman
Member
 
Registered: Jun 2005
Location: Wellington, New Zealand
Distribution: Fedora 9
Posts: 31

Rep: Reputation: 16
Unhappy DF reports wrong disk size


Hello,

I needed to move my ubuntu install from /dev/sda6 (5GB) partition to /dev/sda3 (30GB) partition. I never thought I'd use ubuntu that much so put it on a small test partition.

I have used partimage to create an image of sda6 then restored it to sda3.

When I do a df -h I get the wrong output.
I did investigate using tune2fs -m -0 /dev/sda3 regarding reserved space for /root but this did not help.

I have also tried the resize command.

Please can someone tell me how to correct this.

Code:
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             5.1G  4.2G  672M  87% /
varrun                633M  164K  633M   1% /var/run
varlock               633M     0  633M   0% /var/lock
udev                  633M   72K  633M   1% /dev
devshm                633M   12K  633M   1% /dev/shm
lrm                   633M   39M  594M   7% /lib/modules/2.6.24-19-generic/volatile
/dev/sda3              30G  4.2G   26G  15% /sda3
gvfs-fuse-daemon      5.1G  4.2G  672M  87% /root/.gvfs
Code:
fdisk -l
/dev/sda3            4605        8453    30917092+  83  Linux
Also my grub partition is not correct, I tried to reinstall grub using.

>grub
>setup (hd0,2)

but something is still not right as it is using the /sda6 menu.lst options.

Last edited by pobman; 11-08-2008 at 05:55 AM.
 
Old 11-08-2008, 07:16 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
When you copy a partition at the byte level (with dd or similar tools), you are copying the entire filesystem---which will be the same size even in a newer, larger, space. I'm not sure what partition resizing tools do in such a situation. (What "resize command" did you use?)

As for installing GRUB, the shell method you show requires 3 commands:
grub
root
setup

Example, to point GRUB to drive 1, partition 3 for its files, and then install the the MBR of drive 1:
grub
root (hd0,2)
setup (hd0)

(remember that GRUB counts from zero)
 
Old 11-12-2008, 09:33 AM   #3
VinayatLQ
LQ Newbie
 
Registered: Nov 2008
Posts: 2

Rep: Reputation: 1
I have the same problem. In my case I am trying to use partimage from a 40GB HDD to a 80GB HDD.
When I do a df -h I get the following on 80GB
Code:
Filesystem                Size      Used Available Use% Mounted on
/dev/sda3                35.9G     22.5G     11.6G  66% /
where as the sfdisk -s /dev/sda3 I get the following on 80GB
Code:
#sfdisk -s /dev/sda3
77352975
Any way out of this?

Quote:
Originally Posted by pobman View Post
Hello,

I needed to move my ubuntu install from /dev/sda6 (5GB) partition to /dev/sda3 (30GB) partition. I never thought I'd use ubuntu that much so put it on a small test partition.

I have used partimage to create an image of sda6 then restored it to sda3.

When I do a df -h I get the wrong output.
I did investigate using tune2fs -m -0 /dev/sda3 regarding reserved space for /root but this did not help.

I have also tried the resize command.

Please can someone tell me how to correct this.

Code:
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             5.1G  4.2G  672M  87% /
varrun                633M  164K  633M   1% /var/run
varlock               633M     0  633M   0% /var/lock
udev                  633M   72K  633M   1% /dev
devshm                633M   12K  633M   1% /dev/shm
lrm                   633M   39M  594M   7% /lib/modules/2.6.24-19-generic/volatile
/dev/sda3              30G  4.2G   26G  15% /sda3
gvfs-fuse-daemon      5.1G  4.2G  672M  87% /root/.gvfs
Code:
fdisk -l
/dev/sda3            4605        8453    30917092+  83  Linux
Also my grub partition is not correct, I tried to reinstall grub using.

>grub
>setup (hd0,2)

but something is still not right as it is using the /sda6 menu.lst options.
 
Old 11-12-2008, 10:57 AM   #4
VinayatLQ
LQ Newbie
 
Registered: Nov 2008
Posts: 2

Rep: Reputation: 1
Smile Solved the wrong disk size issue

Finally I got it working using the resize command. Hope this works for you pobman. Mind you that my filesystem on sda3 is ext3

Here is what I did,

1. Boot you system with a CDROM/USB using any of the rescue linux or knoppix etc. I used sysresccd.
2. After boot up
Code:
umount /dev/sda3 (just in case if it is mounted)
3. do a file system check
Code:
fsck -n /dev/sda3
Output shuld be
Code:
/dev/sda3: clean, <SOMESIZE>>
4.Removed the journal from /dev/sda3, this will make it an ext2 partition
Code:
tune2fs -O ^has_journal /dev/sda3
5. run
Code:
e2fsck -f /dev/sda3
6. resize the partition (with resize2fs without options takes your max size of the disk)
Code:
resize2fs /dev/sda3
7. Next run
Code:
fsck -n /dev/sda3
8. Create journal on /dev/sda3, this will turn sda3 to ext3 partition again
Code:
tune2fs -j /dev/sda3
9. Reboot the system using your original OS (ubuntu in your case?)

Let me know if it works for you
 
Old 11-12-2008, 09:26 PM   #5
pobman
Member
 
Registered: Jun 2005
Location: Wellington, New Zealand
Distribution: Fedora 9
Posts: 31

Original Poster
Rep: Reputation: 16
Thanks a lot VinayatLQ,

In the end I decided to blow away my install and start a fresh, but I will store as I am sure it will happen again, now to try a similar thing on my ntfs partition with that bloat ware.

Thanks
 
Old 12-03-2008, 12:48 AM   #6
davehill
LQ Newbie
 
Registered: Dec 2008
Posts: 1

Rep: Reputation: 0
Thumbs up Hey - thanks!

Thanks, VinayatLQ - I had the same problem and followed your 8 steps - they worked great. df now reports the same size as gparted.

I'm planning to use the partition as a raid1 mirror with a similar HD so it was important to get it right (I'd resized it to match it to the other HD).

There was only one minor difference in what I did - the partition is new and separate from the ones in use (/, /home, etc), so I could unmount it and work on it without using a rescue CD like Knoppix.

I don't think of myself as a newbie, or of this as a newbie-type question, but I appreciate getting help from people that are more expert than me, and I'll try to do the same.
 
Old 08-29-2012, 09:58 AM   #7
schworak
LQ Newbie
 
Registered: Apr 2011
Location: Salem Oregon USA
Posts: 3

Rep: Reputation: 1
Talking

I know it has been a while since this thread has seen any action. I am only posting because this keeps coming up high in my Google searches and I found a simple solution.

I resized my RAID6 array by adding three new drives but DF kept showing the old size.

After some research I found that I simply needed to tell the OS to resize the partition to its maximum size. It took a while but it did it LIVE without unmounting the array and no data loss. As a matter of fact I was even able to write to the disk while it was being resized. I wouldn't try rebooting because that sounds down right dangerous.

It took about 3 hours (+/-) to expand my array from 3T to 6T using this command:

Code:
sudo resize2fs /dev/md9
By not specifying the size you are resizing to, the entire available space is used which is exactly what I wanted.


Last edited by schworak; 08-29-2012 at 10:13 AM.
 
1 members found this post helpful.
  


Reply



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
df reports wrong disk space ioanv Linux - General 4 08-24-2007 08:46 AM
Samba reports wrong disk size to Windows clients mikerose Linux - Server 2 06-21-2007 08:35 PM
USB external Disk reports wrong size alans Linux - Hardware 1 03-17-2005 08:57 AM
SCSI-controller reports wrong disk size Gardener Linux - Hardware 2 08-13-2002 08:23 PM
SuSE 8 Reports Wrong HD Size on install! Tiburon Linux - Distributions 2 07-25-2002 09:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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