1 (edited by bookworm 2009-11-12 18:33:30)

Topic: [SOLVED] Complete device unallocated

Hi,

I have one partition on my pc, Vista running on it. I tried to shrink this partition, because I wanted to install a linux distribution next to Vista. For this, I used the latest GParted version, I did everything as told in this tutorial - I had exactly the same errors, everything as told there. Now, when I started Vista, i looked at my partition and saw it was exactly as big as before.
So I again started GParted, but now it is not showing me any partition on my HDD, it calls the complete device unallocated.
But Vista is still working completly fine, no errors at all.
For testing, I used the kubuntu live cd: When I`m trying to access my hdd there, I recieve the following message:
Klick for image

I used chkdsk, it says there are no problems.

I hope you can help me smile

Thank you very much,

bookworm

2

Re: [SOLVED] Complete device unallocated

To try to determine the source of the problem we will need some more information.

Can you post the output from the following two commands?

fdisk -l -u

     where one of these parameters is a lowercase "L" and not the number one.

parted /path-to-your-disk-device unit s print

     where /path-to-your-disk-device is something like /dev/sda

3 (edited by bookworm 2009-11-05 13:35:21)

Re: [SOLVED] Complete device unallocated

Hi,

thanks for your answer.

parted /dev/sda unit s print:
Can`t have partition outside the disk.

The fdisk output is quite long, do I have to copy it by hand or is there a faster way?


Thank you,

bookworm


Edit:

OK, here comes fdisk -l -u:

Disk /dev/sda: 500,1 GB 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units: sectors of 1*512=512 bytes
Disk identifier 0x423555d8

Device     Boot   Start    End        Blocks      Id    System
/dev/sda1   *     63       976784129  488392033+  7     HPFS/NTFS


[same stuff for USB flash drive]
Partition 1 has different physical/logical endings:
    phys=(249,247,32)  logical=(247,151,32)

I hope I didn`t make a typing error...

4

Re: [SOLVED] Complete device unallocated

From the parted output the problem appears to be that the partition is defined as being larger than disk.

From the fdisk output, this would certainly seem to be the case:
     976,773,168 sectors disk size
     976,784,129 sectors end of partition

How can the partition extend beyond the end of the disk???  :-)

There are a few ways to resolve this problem, but I think the simplest approach would be to try Vista's built-in partition resizing software.

How to resize a partition in Windows Vista

Remember to leave at least 15% space free in the partition for Vista to work properly.

It is also advisable to back up your data prior to resizing or moving partitions in case something should go wrong (power outage, software bugs, hardware problems, etc.)

5

Re: [SOLVED] Complete device unallocated

Hi,

thanks for your answer.

This is not working for me, I recieve the message "access denied" - in both variants described. A posible solution ( temporary no paging file) described in the comments didn`t work for me.

Does anybody know another posibility to shrink your partition?

6

Re: [SOLVED] Complete device unallocated

The message "access denied" implies to me that perhaps you are logged in to Vista as a normal user.  Would you be able to try again while logged in as a user with administrator privileges?

7

Re: [SOLVED] Complete device unallocated

I tried it again with administrator privileges => still the same error.

8

Re: [SOLVED] Complete device unallocated

Which version of GParted are you using?

Also before we proceed, I highly recommend that you make a back up of your data to ensure that nothing important is lost when we try to fix this problem.

Also when resizing did you have the "round to cylinders" checkbox enabled (a check mark in it) or disabled (an empty box)?

9

Re: [SOLVED] Complete device unallocated

To troubleshoot this problem I will also need a copy of the Master Boot Record, and a copy of the Partition Boot Record.  I will provide directions on how to create a copy of these areas of the disk.  You can then post the files on a free sharing site, such as mediafire, and then link to them here.

You will need to either use a live CD that permits you direct access to the internet, or else save these files to media other than your hard drive, such as a USB flash drive, prior to being able to upload them.  If using a USB flash drive, you should plug in the USB flash drive prior to booting from the Live CD.


NOTE:  Be extremely careful when typing the following commands.  Any mistake can cause loss of data.

To create a copy of the MBR:

dd if=/dev/sda of=/tmp/sda.mbr bs=512 count=1

To create a copy of the sda1 PBR:

dd if=/dev/sda of=/tmp/sda1.pbr bs=512 count=1 skip=63

Note that the skip value is simply the starting sector for the partition as shown by the above fdisk -l -u command.

10

Re: [SOLVED] Complete device unallocated

OK,

thank you for your answers - I was at a conference this weekend, so I couldn`t do anything, sorry.

I used the latest gparted version and can`t remember if this checkbox was enabled or not.

The things you write in the second post should be working with a kubuntu live disk, shouldn`t they?

I`ll do the things later this evening.

Thanks again,

bookworm

11

Re: [SOLVED] Complete device unallocated

bookworm wrote:

I used the latest gparted version and can`t remember if this checkbox was enabled or not.

The actual version number would help greatly.  You can find the version number under the menu item Help -> About.

bookworm wrote:

The things you write in the second post should be working with a kubuntu live disk, shouldn`t they?

The fdisk and parted commands should be on the kubuntu live disk.  You can also find these on the GParted Live disk which often contains more recent versions of GParted than the kubuntu live disk has.

12 (edited by bookworm 2009-11-09 18:51:30)

Re: [SOLVED] Complete device unallocated

Ok, I`ll check the version today evening, too.

Oh, you missunderstood me, I meant the commands in post number nine.


Edit: Oh, I remember something: I used the version in parted-magic for the operation, I`m sorry I didn`t write this before. I don`t have parted magic on my flash device anymore, in their changelog they write it`s gparted-0.4.6.

13

Re: [SOLVED] Complete device unallocated

bookworm wrote:

Oh, you missunderstood me, I meant the commands in post number nine.

The dd command should be available on most of the Live CD's too smile

14

Re: [SOLVED] Complete device unallocated

Hi,

you find a .zip-file containing both files here:

http://www.megaupload.com/?d=LZ8GBABQ

Thanks,

bookworm

15

Re: [SOLVED] Complete device unallocated

From the sda.mbr file I can see that the NTFS file system does fit nicely within the partition.  The problem is that both the partition length, and the length of the NTFS volume are both greater than the size of the disk.

976,784,067 - length in sectors of the first partition
976,785,066 - length in sectors of the NTFS volume size
976,773,168 - size in sectors of the entire disk device (from fdisk -l -u) output

NOTE:  The NTFS volume size is always one less than the total length because it does not include the backup sector at the end of the volume

Before going any further, I recall that you typed in the output from "fdisk -l -u".  I need you to confirm the values in the line that said:

255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors

We need to ensure that all of these values are correct prior to any updates because I need to base calculations on these values.  Hence performing the "fdisk -l -u" command again and checking these values is very important.

16

Re: [SOLVED] Complete device unallocated

For playing it safe I made a screenshot:

http://www.img-teufel.de/uploads/Bildschirmfoto101d19f6dpng.png

17

Re: [SOLVED] Complete device unallocated

Okay, in this situation we will need to adjust both the partition table, and the NTFS volume size.


NTFS Volume Size Steps

The change I have made to the PBR file is from a length of 976,784,066 sectors:
00000020   00 00 00 00  80 00 80 00  C2 8A 38 3A  00 00 00 00
To a new length of 976,773,104 sectors:
00000020   00 00 00 00  80 00 80 00  F0 5F 38 3A  00 00 00 00

Note:  The NTFS volume size is always 1 sector less than the total number of sectors in the partition table entry because the NTFS backup sector is not considered part of the NTFS volume.


To apply this change:

1) Download the new NTFS PBR: sda1_new-bookwork.pbr

2) Load the new NTFS PBR on your hard disk.
NOTE:  Be extra careful when entering the commands.  Data loss could result otherwise.

dd if=/path-to-file/sda1_new-bookwork.pbr of=/dev/sda bs=512 count=1 skip=63

Partition Table Steps

The change I have made to the MBR file is from a length of 976,784,067 sectors:
000001C0   01 00 07 FE  FF FF 3F 00  00 00 C3 8A  38 3A 00 00
To a new length of 976,773,105 sectors:
000001C0   01 00 07 FE  FF FF 3F 00  00 00 F1 5F  38 3A 00 00

To apply this change:

3) Download the new MBR: sda_new-bookworm.mbr

4) Load the new MBR on your hard disk.
NOTE:  Be extra careful when entering the commands.  Data loss could result otherwise.

dd if=/path-to-file/sda_new-bookworm.mbr of=/dev/sda bs=512 count=1

Test These Changes

5) Let "GParted" CHECK the partition again.

6) If all seems fine then I would advise running "chkdsk /f /r" multiple times, until there are no more faults.

Also if you know a set of steps to recreate this problem then I would like to hear them.  So far I have been unable to recreate this problem where suddenly the "NTFS volume size is bigger than the device size".

18

Re: [SOLVED] Complete device unallocated

Thanks for your effort!

Before I can continue there`s one more question: I don`t know the linux file-system yet, could you tell me a possible part to the two tables and the path to them? I would like to use my kubuntu livedisk again.

I`m sorry about this triviality but I am really afraid of doing something wrong hmm...

19

Re: [SOLVED] Complete device unallocated

If you are using your Kubuntu Live CD, then the easiest way to do this would be with the following steps:

1) Boot up the kubuntu Live CD
2) Open a web browser (konqueror I believe) and download the two files.  I believe the default locations is on the desktop (the path is ~/Desktop).  At least that is the default location for Firefox.
3) Open a terminal window
4) Verify the location of these files with the command "ls ~/Desktop" to see if this lists the files.
5) If the above is the proper path for the files then run the previously mentioned "dd" commands, but replace "/path-to-file" with the location of these newly downloaded files "~/Desktop"

Hope that helps.

EDIT:
Another way to locate the files would be to have the operating system search for them.  After you have downloaded the files you could use the following command to find one of the files:

find / -name sda_new-bookworm.mbr -print 2>/dev/null

20

Re: [SOLVED] Complete device unallocated

sad sad sad sad sad sad


Ok,

I did everything you wanted me to do - and it`s worse now then before.

At first, here you see a screenshot of running the two commands:
http://www.img-teufel.de/uploads/snapshot18e9133dcpng.png

So I thought everything is fine.

But, when I started Gparted this came:
http://www.img-teufel.de/uploads/snapshot45cbad766png.png

When clicking on "information" I saw this:
http://www.img-teufel.de/uploads/snapshot25d3c78e8png.png

Trying to start windows - unpossible, bluescreen at once for about one second, then restart.
The recovery cd is unable to help.

I made fdisk and parted command again:

http://www.img-teufel.de/uploads/snapshot39a544e58png.png

I made a copy of the two tables, too:

sda.mbr:
http://senduit.com/fd2759

sda1.pbr:
http://senduit.com/d14d52

links are quite slow, sorry...

sad sad sad sad sad sad


Hope somebody can help...

bookworm

21

Re: [SOLVED] Complete device unallocated

The data should still be there.

My mistake.  In the first command to fix the NTFS PBR I specified "skip" when I should have specified "seek".  Fortunately since the command was not able to perform the "skip" action, it did not write anything to the drive.  The second command should be fine.  What has me puzzled is why GParted did not recognize the NTFS file system.

To get you back to your original state, we can restore the original MBR and NTFS PBR.  These files are the ones you originally uploaded in post #14.  You can download these files and restore them with the following two commands:


To restore the previous MBR:

dd if=sda.mbr of=/dev/sda bs=512 count=1

To restore the previous NTFS sda1 PBR:

dd if=sda1.pbr of=/dev/sda bs=512 count=1 seek=63

22

Re: [SOLVED] Complete device unallocated

well,
if it should work with the seek command I can use the edited ones too, can`t I?

Or would you advise me to go back to original state at first?

23

Re: [SOLVED] Complete device unallocated

The original fixes should work too.  There should be no harm in trying them first.  If they do not work, then you can restore back to the original situation.

24

Re: [SOLVED] Complete device unallocated

seems to be working, I will make some more test and - if successfull - mark this topic solved.

Oh, wait, one more question, how would you advise me to continue installing kubuntu on my pc?
Use Gparted again? Use the windows stuff?

Thank you!!!

bookworm

25

Re: [SOLVED] Complete device unallocated

I am glad to hear that the problem appears to be solved now.  smile

I have created a bug report in GParted:
GParted Bug #601574 - ERROR: Current NTFS volume size is bigger than the device size!

Until this problem is resolved I would recommend that you do not use GParted to resize NTFS file systems.

My advice would be to try to use the Vista partitioning tool to shrink the NTFS file system.