Announcement

Collapse
No announcement yet.

<SOLVED> messed up dual boot; need strategy tips

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

    <SOLVED> messed up dual boot; need strategy tips

    I've made a major mistake, due to allowing my focus to wander. I have an HP Netbook Mini on which I've been running a dual boot WinXP / Kubuntu 10.04 (currently) for some time.

    I cannot recall my exact partition layout, but it was something like this:
    1. 40gb: WinXP
    2. 13gb: Kubuntu OS files
    3. 1Gb: Linux swap
    4. 100+Gb: /home

    Using gparted, which I've used many times before, I misread what I was looking at. I very stupidly thought I was looking at my flash drive, and was actually looking at the first partition, containing my installation of WinXP. I recall seeing something like "149mb", which seemed odd, but then I was distracted by a 5 year old boy I was looking after.

    Returning to task, I tried to get gparted to format what I thought was my flash drive, and failed for some reason - I'm not even sure it was an option on the menu. Then I tried just deleting it, and that worked, sadly. At that point there was nothing being reported by gparted, which confused me, so I cruised the main menu and clicked on "recreate partition table", or something like that. I then somehow caught up with myself and realize what I'd done. Ouch!

    So, now, when I try to boot, and get the BIOS asking me for the password I set up a while back, then is nothing but a flashing cursor in the uppermost lefthand position.

    I have a Kubuntu 10.04 live flash disk, and booting that, I cannot find the hard drive on the netbook - not at all.

    "df -h" shows me only the live flash drive.

    I've spend a while searching the forums, and looking at the super grub disk website, but I really don't know what to do next to recover. I clearly have no grub, and presume my WinXP install is gone (no great loss); I have a very good back up of my Linux data that most matters, as I run Unison to keep my netbook and my desktop well synchronized. My email however, is not recently backed up. I hope to get my Thunderbird account data from \home, if I can get back to that.

    So...I'm thinking that I likely can just restosre my WinXP. then Kubuntu 10.04, and go on from there.

    But, I'm wondering if I might have done more profound damage to the netbook hard drive, though. I don't know how to find out. Will it harm anything simply to try the WinXP restoration?

    I'd much appreciate any advice from anyone who has a better sense of the nature of my situation than do I. Much thanks, in advance.

    #2
    Re: messed up dual boot; need strategy tips

    Don't worry, I don't think any of us have gone through the linux world without making at least one mistake like this.

    Maybe I didn't read your post well enough but which partition did you erase? If your /home directory still exists then it seems it'd be easier to reinstall XP and reinstall Kubuntu. I know this is a "brute force" method but it sounds like you're not too attached to the data you have currently on your machine (most of it sounds backed-up) so instead of going through the trouble to restore grub and figure out which partition(s) still exist, it might be less headache to just reinstall everything and start fresh.

    Lesson learned! And it's always the hard way.
    Home: Kubuntu 12.04-amd64; Intel i7-860 on Intel DH55PJ; Nvidia 9500GT; 6GB RAM
    Network Slave: Xubuntu 11.10-x86; Intel P4-Prescott on MSI; 2GB RAM; Nvidia FX5200
    Portable: Xubuntu 11.10-amd64; Asus EeePC 1015PEM

    Comment


      #3
      Re: messed up dual boot; need strategy tips

      It looks to me like I erased the first partition - containing my WinXP install. That's the one which would normally appear by default in the gparted display when it's first launched.

      The key question - will even attempting the WinXP reinstall (something I've done many times, on various machines, but not on this netbook) threaten the partition containing /home? I really think not, but I'm not sure, as I no longer do this often. While I do have the great majority of /home backed up, one or two very large files (like my Thunderbird email account) I back up less often, and loss of those is what most concerns me...

      Thanks...

      Comment


        #4
        Re: messed up dual boot; need strategy tips

        Generally, as long as your haven't overwritten any data, it's still there. Erasing a partition actually erases the partition table but leaves the data intact.

        The bad news is you don't know the exact sectors you used originally to create your partitions.

        You might consider an attempt to re-build the partition table before allow windows to have it's way. It's likely that windows will only see your drive as unformatted thus requiring a full reformat before installing.

        The usual steps involved are:
        1. boot to a livecd or usb
        2. run testdisk to discover partition table entries if they exist
        3. run fdisk to rebuild the table
        4. run file check on the restored partition(s)
        4. re-install grub-pc to the master boot record.
        5. once you're setup and working see my entry on this post: http://kubuntuforums.net/forums/inde...opic=3113977.0 (too late now, but would have saved you this time )

        I'm not going to lie: this will take you a couple of hours (without the 5 year old around ) but has a better than average chance of working.

        If you have in fact only erased the first partition, jump to fdisk and try to recreate it:

        From a liveusb/CD in a terminal window:

        sudo fdisk /dev/sda
        first command: "p" (print partition table)
        results will be current partition table.
        it will look something like
        Code:
          Device Boot   Start     End   Blocks  Id System
        
        /dev/sda2  *     132     182   409657+ 83 Linux
        /dev/sda3       183    60801  486922087  5 Extended
        /dev/sda5  *     183    2271  16779861  83 Linux
        since this is from my drive it will obviously have different numbers and ID codes.

        Notice the missing sectors at the front. Create a partition in this area using start sector 1 and use all the available space;

        command "n"

        and follow the prompts.

        I believe the partition type for ntfs is 86 but you might want someone with an windows install partition to verify that. Set the partition type as the correct one and save the table;

        command "t" to set type and
        command "w" to write the table to disk

        btw: command "m" will show a list of fdisk commands for you.

        Then run "partprobe" to load the new partition table and attempt to mount the newly created /dev/sda1 partition, Again - verify this - but I think ntfs support is included on the liveCD and we do have a utility ntfsfix that will check the partition.

        Finally - in the terminal you'll mount the linux partition you installed grub from originally and run grub-install to reload grub to the Master Boot Record.

        I'll post more on how to do this later - I've got to get to work!

        Please Read Me

        Comment


          #5
          Re: messed up dual boot; need strategy tips

          Thanks for the detailed and helpful response. I fired up my Kubuntu 10.04 live flash drive, installed testdisk, and found my netbook hardrive (HD) to contain an intact partition table that looked about like I thought it should. In summary:

          1. HPFS=NTFS - -40 GB / 37 GiB
          2. Linux swap - 1998 MB / 1906 MiB
          3. Linux - 13 GB / 13 GiB [my e OS installation partition]
          4. Linux - 104 MB / 96 MiB [my /home files]

          Originally. the partitions (1-4) as reported on were marked "logical, bootable, primary, primary", which seemed flatly wrong. I changed this to bootable, primary, primary, primary, and wrote this change to the drive.

          Was this the right thing to do?

          I have stopped at this point, as I'm unsure where I am in the process. It seems like partition 3 should also be bootable, but testdisk wouldn't allow 2 bootables - it said this structure was "bad".

          I think I'm at #3 on your little procedure - or rather it seems to me that I just DID #3... Testdisk seemed to allow me to do what you said I needed to do with fdisk. Did I make a mistake in thinking this?

          If I'm OK at this point, can you give a little more detail on the remaining 2 steps (numbered 4, 4, but actually 4, 5)? -

          Code:
          4. run file check on the restored partition(s)
          4. re-install grub-pc to the master boot record.
          The first eludes my understanding completely. I just don't understand what I'm supposed to do.

          The second is vaguely familiar; upon searching, I find that qqmike ow -writes about this process in his exceptional Grub-2 how-to: http://kubuntuforums.net/forums/inde...opic=3106368.0

          Thanks again for your help...and I hope for just a little more of it!



          Comment


            #6
            Re: messed up dual boot; need strategy tips

            sorry about the numbering added in a step and forgot to fix the sequence!

            Anyway - none of your linux partitions need be flagged bootable. linux doesn't care and only one is allowed per disk anyway. I don't have any flagged as bootable and I have 8 os's installed. I agree that all your partitions appear to be primary and you should verify partition id's are correct: 83 for 3 and 4, 82 for 2, and 86 (verify this) for 1.

            Check the above and if you make any changes, run partprobe. This forces changes to take effect immediately if possible. Then - by check the file system - I mean run a file check on it. testdisk doesn't check for or repair errors to your file system, just your partition table. What commands are actually used vary with the file system. Assuming ext3 or ext4 on partitions 3 and 4 the command is fsck -pf /dev/sda3 and ...sda4. I would try and boot windows without using a linux ntfs file check initially as I am skeptical of their abilities.

            At this point you can go ahead and try to boot up if you want. Since grub only resides in the first 446 bytes of the drive it might be fine. In the event it's not fine: Again from the liveusb in a terminal you must mount the partition that contains the grub-pc files and then re-install grub.

            Commands required:

            sudo mount /dev/sda3 /mnt
            sudo grub-install --root-directory=/mnt/boot /dev/sda


            You would go through these same steps if you were to have to re-install windows.

            This should allow you to boot again. I would boot to linux, mount your windows partition and copy your personal data to a linux partition for backup in case windows won't boot and you must re-install it. If so - afterwards to the above again to restore grub boot-ability.

            Couple of comments:

            In your list above you give 2 sizes per partition. Is the 2nd number space remaining or used?

            For future use: Hard drives are only allowed 4 primary partitions. 1 of these may be an extended partition which can the hold up to 63 logical partitions. If you use all 4 primary partitions without an extended partition you are limited to 4 partitions period. If you make 1 primary an extended partition - you have the ability to have data on up to 66 partitions. Why does this matter? With your current setup, you have to install wipe a partition to do a new install. If you had 1 extended partition holding 1 logical partition, you could resize a partition smaller to free some space, add a 2nd logical partition. It's just a flexibility/convenience thing. You might want to try another distro or do a clean install instead of an upgrade down the road.

            Please Read Me

            Comment


              #7
              Re: messed up dual boot; need strategy tips

              First, thanks so much for your very useful response. I've made good use of it. My partition ids are in order (NTSF is "7", by the way), and my linux filesystem check yielded no errors. I'm now attempting to reinstall grub, and...encountering an unexpected problem.

              As I must at this point move to another computer 25 miles away, AND my problem has become very focused, I'm starting a new thread. My reasoning is that that will draw more response more quickly - people won't have to wade through previous posts to see what I'm working on.

              You've asked some questions I have not responded to yet, and I will. I just need to get my Kubuntu installation to boot so I can use that as my primary computer, then I'll return and tie up loose ends. Thanks for all your help...and I'll be back here soon, I hope.

              Comment

              Working...
              X