Skip to contentSkip to conversation

partition size funkiness

DISCUSSION Eric Peden 3 participants 3 messages May 24, 2000

lore
Share & tools
lore

Eric Peden

author
#0 lore raw

Note: this message was originally posted to the linuxppc-user list. I failed to receive any fruitful responses, and am posting it here. I've added a few additional comments after the original message.

-- Begin Original Message --
I have a 4gb disk that I'm currently using for Linux. The drive is split into three main partitions: root, swap, and an HFS exchange (there's a bootstrap, too, but it's not one of the main ones ;). Root is 2.7GB, but when I use df to check drive usage, it reports it as only being 1.4GB. This is obviously not desirable behavior. Anyone have any ideas as to what the problem is? I've checked inodes (as suggested in the archives), but there appear to be plenty.

My partition map (yes, I know there are some very inefficiently sized chunks here; partitioning this drive was a learning experience for me, and I've yet to correct my many mistakes with it):

Quoted 11 lines

Partition map (with 512 byte blocks) on '/dev/sda'
#: type name length base ( size )

1: Apple_partition_map Apple                         63 @ 1
2:      Apple_Driver43*Macintosh                     54 @ 64
3:      Apple_Driver43*Macintosh                     64 @ 118
4:  Apple_Driver_IOKit Macintosh                    512 @ 182
5:       Apple_Patches Patch Partition              512 @ 694
6:           Apple_HFS MacOS/Preferred LinuxPPC 2097152 @ 1206    (  1.0G)
7:     Apple_UNIX_SVR2 /                        5529600 @ 2098358 (  2.6G)
8:     Apple_UNIX_SVR2 swap                      262144 @ 7627958 (128.0M)
9:     Apple_Bootstrap bootstrap                 204800 @ 7890102 (100.0M)
Quoted 4 lines

10: Apple_Free Extra 376328 @ 8094902 (183.8M)
11: Apple_Free Extra 2 @ 8471230

Device block size=512, Number of Blocks=8471231 (4.0G)

Output of "df -ih"

Quoted 3 lines

Filesystem Inodes IUsed IFree IUse% Mounted on

/dev/sda7               376k     79k    297k   21% /
/dev/sda6                62k     41k     21k   66% /mnt/exchange

and "df -h"

Quoted 3 lines
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda7             1.4G  1.1G  222M  84% /
/dev/sda6             1.0G  679M  345M  66% /mnt/exchange

When I first set up this drive, I had separate root and /usr partitions, but /usr quickly filled up while root stayed mostly empty. I backed up, merged, and restored the two awhile back. Could I have introduced the problem during this process?

Any help is greatly appreciated. I don't like having 1GB+ of unusable space on my drive, especially since I'm trying to install several large programs right now.
-- End Original Message --

I've begun to suspect that my problems are due to the method I used to "re-partition" the drive; I simply used pdisk to re-arrange the partition map, thus doing a non-destructive repartitioning. I've only managed to find one mention of a problem similar to mine at:

http://slashdot.org/askslashdot/99/08/09/0315246.shtml

The cause is different, and of course no solution is offered, but the symptoms are the same. Is partition information stored somewhere other than the partition map? Is df just reading this information incorrectly, or is the extra space on /dev/sda7 truly unusable? Is there some low-level information I could modify to properly reflect the size of root?

Again, help is appreciated...

--eric

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#1 lore raw

Hi there,

On 23 May, this message from Eric Peden echoed through cyberspace:

Quoted 3 lines

I've begun to suspect that my problems are due to the method I used to "re-partition" the drive; I simply used pdisk to re-arrange the partition map, thus doing a non-destructive repartitioning.

I'm sure that is your problem right there. I bet 1.4 gig was the size of your root partition before extending the partition?

Quoted 5 lines

The cause is different, and of course no solution is offered, but the symptoms are the same. Is partition information stored somewhere other than the partition map? Is df just reading this information incorrectly, or is the extra space on /dev/sda7 truly unusable? Is there some low-level information I could modify to properly reflect the size of root?

Partition information is only stored in the partition map, however no partition is usable as-is. You need to create a filesystem on a partition before it is usable to any OS (well, in general at least ;-). Your problem is that you didn't recreate the filesystem when you made your partition larger. It worked for you (sortof...) only because the starting block of your partition:

Quoted 1 line

7: Apple_UNIX_SVR2 / 5529600 @ 2098358 ( 2.6G)

this number: ^^^^^^^

stayed at the same place as one of your previous partitions.

The only solution is to back up your data again, and re-create the filesystem on all affected partitions:

mke2fs /dev/sda7 (your new root partition)

If you moved your swap partition as well, you might want to do a:

mkswap /dev/sda8

but I've run successfully without that part.... It can't hurt, though.

Hope this helps, and good luck

Michel

-------------------------------------------------------------------------

Michel Lanners                 |  " Read Philosophy.  Study Art.
23, Rue Paul Henkes            |    Ask Questions.  Make Mistakes.
L-1710 Luxembourg              |
email   [email protected]            |
http://www.cpu.lu/~mlan        |                     Learn Always. "

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw
In reply to Eric Peden

On Tue, May 23, 2000 at 09:16:42PM -0500, Eric Peden wrote:

[deletia]

Quoted 5 lines

I've begun to suspect that my problems are due to the method I used to "re-partition" the drive; I simply used pdisk to re-arrange the partition map, thus doing a non-destructive repartitioning. I've only managed to find one mention of a problem similar to mine at:

how exactly did you backup/restore the data? you cannot just change the partition tables without doing something to the filesystems too, you can use ext2resize, or tar up the data and mke2fs the partition, and untar everything back. but if you just changed the partition table and did nothing to the filesystems you are looking at filesystem corruption and massive data loss to occur very soon. this is because the filesystem has its own idea about the size of the partition.

Quoted 7 lines

http://slashdot.org/askslashdot/99/08/09/0315246.shtml

The cause is different, and of course no solution is offered, but the symptoms are the same. Is partition information stored somewhere other than the partition map? Is df just reading this information incorrectly, or is the extra space on /dev/sda7 truly unusable? Is there some low-level information I could modify to properly reflect the size of root?

partition sizes just define to the kernel how much space it should allocate to a given device node eg /dev/hda2. the filesystem when mounted has its own definition of its size, and this has nothing to do with the partition size. if they do not match though you can end up in trouble, either the partition is larger then the filesystem and you have hidden wasted space or you have the filesystem too large and you end up writing data off the end of the device (which the kernel won't permit i don't think) either way its a bad thing.

this is why i am not a big fan of screwing with partitions in non-destructive ways, it just is more trouble then it is worth and usually does not work that well.

Quoted 1 line

Again, help is appreciated...

wipe your partition table entirely, partition everything properly and install debian while your at it ;-)

i know its harsh advice but really i think your just going to waste alot of time and trouble messing around trying to get this fixed with a high liklyhood of destroying the filesystems anyway, why bother with the headache you will be happier in the long run with a properly partitioned, cleaned up system.

Signature · 2 lines
Ethan Benson
http://www.alaska.net/~erbenson/