Announcement

Collapse
No announcement yet.

Existing partition sizes not shown correctly - Partitioning errors 1q3.10

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Existing partition sizes not shown correctly - Partitioning errors 1q3.10

    As explained in several previous posts I had a crash and needed to restore my working partition and the data included therein. Finally managed to get almost everything back. Also updated to 13.10 (from 13.04) in the process.

    However, though the partition table is shown correctly in Windows XP, 13.10 does not completely agree. The partition are there but the partition sizes are incorrect. Some parts of my original installation are missing.

    Here are the results of my exploration of the disk.


    CODE: lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 0 93.2G 0 disk
    ├─sda1 8:1 0 48.3G 0 part
    ├─sda2 8:2 0 21.6G 0 part
    ├─sda3 8:3 0 22.7G 0 part /
    ├─sda4 8:4 0 1K 0 part
    └─sda5 8:5 0 629M 0 part [SWAP]
    sr0 11:0 1 1024M 0 rom

    This table is a correct representation of the intended partitions on the harddrive.
    sda2 is the Windows XP partition. Size ~ 21G
    sda3 is a Linux partition with 13.10 installed. Size ~ 23G

    sda1 is my main working Linux partition with 13.10.

    Problem:

    The size of sda1 is correct in the above table - ~48G. However this correct size does not show in any other query.
    Or the partition does not show at all.

    CODE: sudo fdisk -u -l

    Disk /dev/sda: 100.0 GB, 100030242816 bytes
    255 heads, 63 sectors/track, 12161 cylinders, total 195371568 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0004fe62

    Device Boot Start End Blocks Id System
    /dev/sda1 * 2048 101330943 50664448 83 Linux
    /dev/sda2 148906485 194081264 22587390 7 HPFS/NTFS/exFAT
    /dev/sda3 101330944 148905983 23787520 83 Linux
    /dev/sda4 194082814 195371007 644097 5 Extended
    /dev/sda5 194082816 195371007 644096 82 Linux swap / Solaris

    Here it is shown but not in the conventional manner.
    Code: 'df -aT -h' results in an almost identical readout.

    Here comes the problem:

    CODE: sfdisk -ls /dev/sda

    97685784

    Disk /dev/sda: 12161 cylinders, 255 heads, 63 sectors/track
    Warning: extended partition does not start at a cylinder boundary. <-----------------------------
    DOS and Linux will interpret the contents differently.
    Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

    Device Boot Start End #cyls #blocks Id System
    /dev/sda1 * 0+ 6307- 6308- 50664448 83 Linux <----------------------------------
    end: (c,h,s) expected (1023,254,63) found (1023,142,43)
    /dev/sda2 9269 12080 2812 22587390 7 HPFS/NTFS/exFAT <---------------------------
    start: (c,h,s) expected (1023,254,63) found (1023,0,1)
    /dev/sda3 6307+ 9268- 2962- 23787520 83 Linux
    /dev/sda4 12081+ 12161- 81- 644097 5 Extended
    /dev/sda5 12081+ 12161- 81- 644096 82 Linux swap / Solaris


    And forcing information on the main working partition has this result:

    CODE: sudo sfdisk -ls /dev/sda1

    50664448
    Warning: start=2048 - this looks like a partition rather than
    the entire disk. Using fdisk on it is probably meaningless.
    [Use the --force option if you really want this]
    peter@pjj:~$ sudo sfdisk -ls -f /dev/sda1
    50664448

    And forcing information on /dev/sda1 finally explains the problem.

    CODE: sudo sfdisk -ls -f /dev/sda1

    50664448

    Disk /dev/sda1: 6307 cylinders, 255 heads, 63 sectors/track

    sfdisk: ERROR: sector 0 does not have an msdos signature
    /dev/sda1: unrecognized partition table type
    No partitions found


    So, now I know what causes the strange behavior of my installation.
    The great question now is however:

    How do I fix this problem without destroying the existing data?

    Could I please get some expert partitioning advice?



    PS: How do I get rid of the typo in the title?
    Last edited by PJJ; Oct 30, 2013, 01:17 PM. Reason: Typo

    #2
    I'd start backing up your data from the /home partition.

    Then you could give it a shot by running a Live disk or USB drive and using the partitioning tool to slightly resize and shift the partitions adjacent to the reported bad sector.
    These operations take time but I give it a fair chance of getting this fixed.

    Comment


      #3
      Originally posted by Teunis View Post
      I'd start backing up your data from the /home partition.

      Then you could give it a shot by running a Live disk or USB drive and using the partitioning tool to slightly resize and shift the partitions adjacent to the reported bad sector.
      These operations take time but I give it a fair chance of getting this fixed.
      Thank you for the advice.
      The partition next to the bad part is a ntfs partition.

      I presume I could not use the partitioning tool from inside the existing partitions?
      Or from XP?

      But that caused the problem in the first place.

      'testdisk' is too risky, I also assume.

      Comment


        #4
        Over the years I've had good experiences with the included partitioning tool.
        There are also special Gparted Live disks, in case you have a good download speed you can try them.
        http://gparted.sourceforge.net/livecd.php
        No you can't fix mounted partitions, that's why the Live disk comes in handy.

        Some 2 years ago I've had a similar problem but was not able to fix it without a complete reformat of the disk...

        Comment


          #5
          Testdisk and even fdisk can usual fix theses sorts of problems, however more often than not the fixing is more tedious than backing up, reformatting, and restore.

          Presuming the windows/ntfs partition is OK, you'd be better off save your home and recreating that partition. Having said that, what's the output of:

          sudo sfdisk -d /dev/sda

          Please Read Me

          Comment


            #6
            I attempted earlier to post a reply but had to do something else. It apparently was not saved. Anyway, I already have the Live CD for Gparted. Unfortunately I cannot change the mount point of the partition in question neither in Gparted Live Cd nor in rescue mode. The GUI remains unresponsive, but CLI commands are taken, but nor reflected in fstab or mtab or reported as errors.

            The good news: I have my partition table back - as it was before I made /dev/sda1 (43G) appear. In other words: No sda1 partition, though it is shown by testdisk, gparted and fddisk. I will somehow get it back.

            I will post some data in response to oshunlvr.

            Comment


              #7
              Hi there. Just did that command before I saw your message.
              Here it is somewhat modified:

              sudo fdisk -c -u -l /dev/sda

              Disk /dev/sda: 100.0 GB, 100030242816 bytes
              255 heads, 63 sectors/track, 12161 cylinders, total 195371568 sectors
              Units = sectors of 1 * 512 = 512 bytes
              Sector size (logical/physical): 512 bytes / 512 bytes
              I/O size (minimum/optimal): 512 bytes / 512 bytes
              Disk identifier: 0x0004fe62

              Device Boot Start End Blocks Id System
              /dev/sda1 2048 101330943 50664448 83 Linux
              /dev/sda2 101330944 148905983 23787520 83 Linux
              /dev/sda3 * 148906485 194081264 22587390 7 HPFS/NTFS/exFAT
              /dev/sda4 194081265 195371567 645151+ f W95 Ext'd (LBA)
              /dev/sda5 194082816 195371007 644096 82 Linux swap / Solaris

              Somehow the situation got messed up again. Code 'sudo sfdisk -d /dev/sda' now gives:
              sudo sfdisk -d /dev/sda
              [sudo] password for peter:
              # partition table of /dev/sda
              unit: sectors

              /dev/sda1 : start= 2048, size=101328896, Id=83
              /dev/sda2 : start=101330944, size= 47575040, Id=83
              /dev/sda3 : start=148906485, size= 45174780, Id= 7, bootable
              /dev/sda4 : start=194081265, size= 1290303, Id= f
              /dev/sda5 : start=194082816, size= 1288192, Id=82

              Looks essentially like the previous one, except I made XP bootable. Did not work because file hal.dll is corrupt or missing and needs to be re-installed. Sda3 is the XP partition.
              But I can boot into /dev/sda2.

              /dev/sda1 is not bootable at all.
              Above code on /dev/sda1 results in:




              peter@pjj:~$ sudo sfdisk -d /dev/sda1
              Warning: start=2048 - this looks like a partition rather than
              the entire disk. Using fdisk on it is probably meaningless.
              [Use the --force option if you really want this]

              peter@pjj:~$ sudo sfdisk -f -d /dev/sda1

              sfdisk: ERROR: sector 0 does not have an msdos signature
              /dev/sda1: unrecognized partition table type
              No partitions found

              "Disk /dev/sda1 doesn't contain a valid partition table."


              I fixed this error last night with testdisk. It rewrote the MBR mounting the partitions on /media with their labels.
              When I tried to move the mount points, I messed it up again.

              But at least I can boot the machine.
              Last edited by PJJ; Oct 31, 2013, 04:45 PM. Reason: added detail

              Comment


                #8
                You keep running sfdisk on sda1. sda1 is a partition. Partition Volume Boot Records do not normally contain partition tables. Therefore, this;

                Warning: start=2048 - this looks like a partition rather than
                the entire disk. Using fdisk on it is probably meaningless.
                [Use the --force option if you really want this]
                and these

                sfdisk: ERROR: sector 0 does not have an msdos signature
                /dev/sda1: unrecognized partition table type
                No partitions found
                "Disk /dev/sda1 doesn't contain a valid partition table."
                are the expected results.

                Please Read Me

                Comment


                  #9
                  Originally posted by oshunluvr View Post
                  You keep running sfdisk on sda1. sda1 is a partition. Partition Volume Boot Records do not normally contain partition tables. Therefore, this . . .
                  Indeed I do. But I am also running the code on /dev/sda, which gives me the correct results as shown above. The partitions shown in response to the sfdisk on /dev/sda are correct.

                  BUT: /dev/sda1 does not show up at boot up of the computer. All other partitions do.

                  It is also shown in the partition manager with a size of 48.3G, the correct size and a label of '1310N' that is also correct.
                  Properties indicate that the partition is not mounted.
                  Option shown: "Mount"

                  However: Dolphin has '1310N' with a size of 22.2G. It also gives that size for /dev/sda2 (1204Rescue).
                  Last edited by PJJ; Nov 01, 2013, 12:05 PM.

                  Comment


                    #10
                    Well, my point was that running sfdisk on /dev/sda1 will show those errors and continue to do so. It has nothing to do with your problem and does nothing for your situation. It even tells you "it's rather meaningless."

                    I would like to know what exactly you mean by "...does not show up at boot up of the computer." ? If fdisk is reading the partition table and the partition is in it, it's "showing up." If you mean you can't boot to it, that's an entirely different matter. Those geometry errors in your first post are worrisome, however. I assume your Windows install still boots?

                    I would boot to Windows, run windows check disk on it. Then boot back to the liveUSB or whatever you're using, save your data off of sda1, and delete it and re-create it. You could do this in less time than you've spent on this thread. Messing with the geometry may fix it or may result in your windows install also not booting. I'm not really comfortable advising you do to that.

                    Please Read Me

                    Comment


                      #11
                      I agree and I am grateful for your input. The actual mystery, at least for me, is in the fact that partition manager, XP, sfdisk all have the partition /dev/sda1 correctly. However, after booting up the computer the partition /dev/sda1 with label '1310N' is listed with an incorrect size - 22.2G instead of 48.3G everywhere else.

                      Please also note that the partition manager (though showing the size and label of the partition correctly) indicates that the partition is not mounted - among 'properties' it states as one of the possible actions: "Mount".

                      Trying to mount it does not change anything.

                      You are also correct in pointing out the time invested in this issue. It might be better and faster to re-install 13.10 on /dev/sda1.
                      The data are available on a backup.

                      Finally, windows now give me the common "hal.dll missing or corrupted error" and does no longer start.
                      I could fix that.

                      Comment


                        #12
                        I suspect the error in size is related to the messed up geometry reporting. Something (a power crash during formatting?) trashed the MBR and/or VBR. If we knew the correct numbers, you could fix it with testdisk. But again - it's also possible that things could get worse. The real troubling part is the windows partition giving you trouble.

                        If you decide to re-create sda1 - I would delete it first, then fix the windows errors, then when that's all done and windows is booting again - then recreate sda1 and start over with it.

                        I'm searching around, but haven't yet found any way to determine the "true" geometry settings. You could always try what sfdisk suggested above and cross your fingers.

                        Please Read Me

                        Comment


                          #13
                          sudo sfdisk -g /dev/sda

                          should show geometry

                          Please Read Me

                          Comment


                            #14
                            These will copy, save, and re-write the partition table:

                            sudo sfdisk -d /dev/sda > ptable.txt

                            sudo sfdisk --no-reread -f /dev/sda -O ptable.save < ptable.txt

                            Use at your own peril!

                            Please Read Me

                            Comment


                              #15
                              Thank you for your suggestions. I apologize for the late response.
                              The issue is resolved. The problem was apparently created when I added or replaced partitions after installation of XP. I designated one partition as '/' and made several other partitions. Unfortunately, I created a 'home' partition without really understanding well what it does.
                              I intended partition 'sda1' to be located on 'home'.
                              Well, it was not. But rather my other working partition(s) 12.04 and/or 12.10 were reflected there.

                              Since I did not assign '/' to sda1 but only to sda4 the partition did show 'sda1' but did not read any files on it or anything else associated with it. Only after I took the plunge and daringly assigned '/' to sda1 and the other root partition did the long seen but missing in action partition 'sda1' appear - in all its glory but minus data.

                              My computer is restored and working fine. No data were lost because I had made some duplicate backups.

                              Problem solved.

                              Comment

                              Working...
                              X