Announcement

Collapse
No announcement yet.

Resizing of ext3 partition went wrong - bad superblock message [SOLVED]

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

    Resizing of ext3 partition went wrong - bad superblock message [SOLVED]

    Hi guys,

    I tried to resize my system partition (ext3), because I deleted my WinXP installation and the partition which held it. So I had some space before and after my Kubuntu system partition.
    'fdisk -l /dev/sda' gave me:
    Code:
    /dev/sda 80.0 GB 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders
    Units = cylinders of 16065 * 512 = 825280 bytes
    
    Device Boot   Start    End   Blocks      Id System
    /dev/sda1    1       128   1461883+   82 Linux swap / Solaris
    /dev/sda3    2551    5099  20474842+ 83 Linux
    Then I followed the instructions on http://www.howtoforge.com/linux_resi..._partitions_p2 to resize the partition to the maximum. To do so I used a Kubuntu 8.04 live CD.
    The resizing of the partition went well,
    Code:
    root@ubuntu:/home/ubuntu# fdisk -l /dev/sda
    
    Disk /dev/sda: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
     Device Boot   Start    End   Blocks Id System
    /dev/sda1       1    182  1461883+ 82 Linux swap / Solaris
    /dev/sda3      183    9729  76686277+ 83 Linux
    but after the reboot, when I tried to execute 'e2fsck -f /dev/sda3' I got:
    Code:
    e2fsck 1.40.8 (13-Mar-2008)
    e2fsck: Superblock invalid, trying backup blocks...
    e2fsck: Bad magic number in super-block while trying to open /dev/sda3
    
    The superblock could not be read or does not describe a correct ext2
    filesystem. If the device is valid and it really contains an ext2
    filesystem (and not swap or ufs or something else), then the superblock
    is corrupt, and you might try running e2fsck with an alternate superblock:
      e2fsck -b 8193 <device>
    After some reading I found 'mke2fs -n /dev/sda3':
    Code:
    mke2fs 1.40.8 (13-Mar-2008)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    4800512 inodes, 19171569 blocks
    958578 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=0
    586 block groups
    32768 blocks per group, 32768 fragments per group
    8192 inodes per group
    Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424
    So I tried to use the backup superblocks with commands like 'e2fsck -b 32768 /dev/sda3' (for the other blocks mentioned above respectively):
    Code:
    e2fsck 1.40.8 (13-Mar-2008)
    e2fsck: Device or resource busy while trying to open /dev/sda3
    Filesystem mounted or opened exclusively by another program?
    I'm sure, that /dev/sda3 is not mounted. So for now, I'm clueless how to fix the filesystem. It would bad if I'd loose the data.

    Thanks for your help in advance.
    Cheers,
    Cornelius

    #2
    Re: Resizing of ext3 partition went wrong - bad superblock message

    Oh My

    The best way to resize a partition, IMHO, is with a graphical tool, like gparted, qtparted, etc. You can install them from the live cd if not there (they install in memory) and use them. They will make many sanity checks, let you know if certain decisions will screw up your data, etc

    I may be wrong, but afaik, ext3 can only be extended at the final end (movinge the end to the "right", not by moving the start to the "left")

    Have you tried using dfisk to move the partitions to the original locations? (cylinder 2551-5099 for sda3).

    If you haven't modified the actual data, this might work. Just use the same as befor,e I think it was fdisk. Then fire up qparted or something. Most likely, it is better for you tou create another ext3 partition between 129 and 2550, and eventually move /home there (it is always better to have /home in a separate partition to avoid, well, losing data

    hope this helps

    cheers
    leo

    Comment


      #3
      Re: Resizing of ext3 partition went wrong - bad superblock message

      I'll toss this out as general guidance ...

      TestDisk * might * be able to locate the previous partition(s) for you.
      Takes some messing and working and playing, but I've seen it do amazing things.

      Knoppix Live CD * might * help you locate your data and rescue it off to a flash drive or CD.

      An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

      Comment


        #4
        Re: Resizing of ext3 partition went wrong - bad superblock message

        Hello again,

        thanks for the quick replies.
        I tried Testdisk, which gives me the following log file:
        http://pastebin.com/m547ff894
        I'm now a little bit confused, because Testdisk states the beginning of the old partition /dev/sda3 (i.e. before my stupid actions) as 2550 where 'fdisk -l /dev/sda' gave me 2551 before. Is there some shifting because of different starting blocks? (0 instead of 1?)
        So, I hope, that I can bring back the data by reversing the partition to its old size and position. Which steps should I take to achieve that (with a minimum risk to destroy data)? Sorry, this is very new to me and with the recent experience in mind I'm extra-cautious.

        Thanks,
        Cornelius

        Comment


          #5
          Re: Resizing of ext3 partition went wrong - bad superblock message

          I think I would use fdisk (from the live CD). NEVER format anything, just try to create a partition exactly like yo u had before (use the same cylinders as before, i.e. 2551, not 2550). Save the partition table, and see if you can then see the contents of the partition. From the live CD, you should be able to see the contents. I've been there before, and I was able to recover following these steps. Hope you can, too. Keep us posted.

          All the best !
          Leo

          Comment


            #6
            Re: Resizing of ext3 partition went wrong - bad superblock message [SOLVED]

            I used fdisk to delete /dev/sda3 and created a new one with the old specifications. After a reboot I was able to boot my Kubuntu as usual. Now, I'm relieved!
            Thank you!

            For now my partition is marked as ext2, I think because I ripped the journal from it before. I will now study the whole thing a bit more, before doing anything again. Is the journal somehow important? If you could point me to an article where this is explained and maybe some thoughts about partitioning structure (i.e. one or more partitions, LVM or anything like that, where should /home go, which filesystems, ...), it would me help me greatly.

            Cheers,
            Cornelius

            Comment


              #7
              Re: Resizing of ext3 partition went wrong - bad superblock message

              ext2 vs. ext3
              Windows no longer obstructs my view.
              Using Kubuntu Linux since March 23, 2007.
              "It is a capital mistake to theorize before one has data." - Sherlock Holmes

              Comment


                #8
                Re: Resizing of ext3 partition went wrong - bad superblock message [SOLVED]

                Originally posted by cornelius
                I used fdisk to delete /dev/sda3 and created a new one with the old specifications. After a reboot I was able to boot my Kubuntu as usual. Now, I'm relieved!&#160;
                Thank you!
                Awesome! I am happy we made it, this is what free software is all about.

                For now my partition is marked as ext2, I think because I ripped the journal from it before. I will now study the whole thing a bit more, before doing anything again. Is the journal somehow important? If you could point me to an article where this is explained and maybe some thoughts about partitioning structure (i.e. one or more partitions, LVM or anything like that, where should /home go, which filesystems, ...), it would me help me greatly.
                (Snowhog just showed how to convert / to ext3.)

                Ok, there are a million theories. I like it simple: a 10-20 gig partition for /, a small one for swap (1-2 gig), and the rest for /home. The idea is that you may screw up things in / in the next install/upgrade, and that will make you lose your data, unless /home is in a separate partition. For large partitions (for /home), xfs works best, otherwise ext3.

                If I were you, I would create an ext3&#160; (or xfs) partition in the extra space you have from a live CD, maybe using gparted. Then, carefully, copy /home (copy, not move) to there.&#160; It will take some time, trials and errors, but you'll be copying, so you'll never lose your data. At some point, you'll need to modify /etc/fstab (still from the live CD), and add a line for the new /home, something like this:

                Code:
                /dev/sda2 /home ext3 nouser,atime,auto,rw,dev,exec,suid 0 2
                Keep a copy of the old /etc/fstab. If it doesn't boot up correctly next time, simply boot from the live cd and re-instate the original /etc/fstab. If it does, now /home will be safe, in a separate partition.&#160; After you are done with this process, you'll have the old /home data in /dev/sda3 to be freed.

                Cheers!

                Comment


                  #9
                  Re: Resizing of ext3 partition went wrong - bad superblock message

                  Amazingly good work here, cornelius! And no question lmilano knows the stuff. And most of us here agree with his point that, say, GParted Live CD is the tool to use when editing partitions (creating, moving, resizing, etc.). This thread does, however, illustrate the power of fdisk: you can specify the parameters of the partition down to details (this is not so with GParted); so for this repair , fdisk really did the trick. As for TestDisk and the 0 vs 1, when messing with partitions, you see such discrepancies from time to time. In your case, lmilano gave the best advice (imo): stick with what fdisk tells you (be it "right" or "wrong") and use it to duplicate the partition work, "as is." (I'm guessing that had you gone with TestDisk for repairs, then you would accept how it sees things and hope for the best.)


                  *************
                  EDIT added:
                  Partitioning—how to, Rog131:
                  http://kubuntuforums.net/forums/inde...opic=3090704.0
                  An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                  Comment


                    #10
                    Re: Resizing of ext3 partition went wrong - bad superblock message

                    Yes, very good work. Truly impressive. I looked at the howtoforge link briefly. In fact, I've bookmarked it. I'm sure that it will come in handy someday.

                    You've probably noticed posts with subject lines containing SOLVED. This identifies problems that have been solved. This is very useful to others who are searching KFN with similar problems, as it lets them know that a solution was found. All you have to do is return to your initial post in this thread, click the modify button and add SOLVED to the subject line.
                    Windows no longer obstructs my view.
                    Using Kubuntu Linux since March 23, 2007.
                    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                    Comment


                      #11
                      Re: Resizing of ext3 partition went wrong - bad superblock message

                      Thanks to you, I was able to get my old system back. But of course I didn't stop reading, thinking and playing around.
                      So I downloaded and burned the gparted live CD and tried to do as Imilano has suggested. Now my system is still working , but there is some new confusion.

                      Should I post in this thread or mark it as solved and start a new?

                      Cheers,
                      Cornelius

                      Comment


                        #12
                        Re: Resizing of ext3 partition went wrong - bad superblock message

                        I'd say "mark this thread solved" and start a new one. That will keeps things 'clean' and uncluttered.
                        Windows no longer obstructs my view.
                        Using Kubuntu Linux since March 23, 2007.
                        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                        Comment


                          #13
                          Re: Resizing of ext3 partition went wrong - bad superblock message

                          Originally posted by Snowhog
                          I'd say "mark this thread solved" and start a new one. That will keeps things 'clean' and uncluttered.
                          And you could have one more post here linking to the new thread, so we find it. Thanks!

                          Comment


                            #14
                            Re: Resizing of ext3 partition went wrong - bad superblock message [SOLVED]

                            http://kubuntuforums.net/forums/inde...opic=3098570.0

                            Comment

                            Working...
                            X