LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Really messed up my partition table (https://www.linuxquestions.org/questions/linux-hardware-18/really-messed-up-my-partition-table-286162/)

scuzzman 02-04-2005 08:36 AM

Really messed up my partition table
 
I think I really screwed the pooch this time. I wanted to get rid of Windows on my Slackware box, so I erased the partition :tisk: Now, I can't do anything with the 30GB that was there. Maybe I should just show what is happening:
Code:

[root@slackdell /home/scuzzy]$ fdisk -l

Disk /dev/hda: 40.0 GB, 40000000000 bytes
16 heads, 63 sectors/track, 77504 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hda1  *          1      58251    29358472+  83  Linux
/dev/hda2          58252      76979    9438187+  83  Linux
/dev/hda3          76979      77505      265072+  82  Linux swap
[root@slackdell /home/scuzzy]$ lilo
Fatal: First sector of /dev/hda1 doesn't have a valid boot signature
[root@slackdell /home/scuzzy]$ fsck /dev/hda1
fsck 1.35 (28-Feb-2004)
e2fsck 1.35 (28-Feb-2004)
Couldn't find ext2 superblock, trying backup blocks...
/sbin/e2fsck: Bad magic number in super-block while trying to open /dev/hda1

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>

[root@slackdell /home/scuzzy]$

I've tried deleting/recreating the drive using fdisk. cfdisk simply craches with this message when I try to run it:
Code:

FATAL ERROR: Bad primary partition 2: Partition ends in the final partial cylinder
                          Press any key to exit cfdisk

and when I try to write a partition to it using parted or mkfs, the programs just crash with no error messages...
What's odd, is through all this partitioning, lilo still works (I wanted to reinstall it after removing the Windows option) so I know the MBR (somehow) survived...
Also, just in case it should help, here's this:
Code:

[root@slackdell /home/scuzzy]$ cat /etc/fstab
/dev/hda3        swap            swap        defaults        0  0
/dev/hda2        /                ext3        defaults        1  1
#/dev/hda1        /disk1          ext3        defaults        1  1
/dev/cdrom      /mnt/cdrom      iso9660    noauto,owner,ro  0  0
/dev/fd0        /mnt/floppy      auto        noauto,owner    0  0
devpts          /dev/pts        devpts      gid=5,mode=620  0  0
proc            /proc            proc        defaults        0  0
[root@slackdell /home/scuzzy]$

The /dev/hda1 is commented out because I don't want to mount it while it's still screwed.

Any ideas?

Lazarus 02-04-2005 10:18 AM

It may be a silly question but when you created the partition did you then create a file system on it eg

mke2fs /dev/hda1

or

mkreiserfs /dev/hda1

must be done before the partition is used. NB any data in there will be distroyed!

Matir 02-04-2005 10:59 AM

I think a lot of your errors are due to hda2 and hda3 overlapping. You may want to look into that as well. If you have filesystems on all partitions, you could be in for a bit of a headache.

abisko00 02-04-2005 11:07 AM

I think the problem is the overlap between hda2 and hda3. They should not used the same cylinder as start and stop. How did that happen? If you deleted hda1, that means it has like this before? Maybe you could resize one of these partitions.

scuzzman 02-04-2005 11:28 AM

The install overlapped the 2 partitions... They've been like that the entire time... I'll look into resizing them properly though...

scuzzman 02-04-2005 11:42 AM

Quote:

Originally posted by Lazarus
It may be a silly question but when you created the partition did you then create a file system on it eg

mke2fs /dev/hda1

or

mkreiserfs /dev/hda1

must be done before the partition is used. NB any data in there will be distroyed!

Well, this looked like it had gone through...
But, when I tried reinstalling LILO to it, this happened:
Code:

[root@slackdell /home/scuzzy]$ lilo
Fatal: First sector of /dev/hda1 doesn't have a valid boot signature
[root@slackdell /home/scuzzy]$

Also - generating the same errors when running cfdisk, but passing fine when I run fsck:
Code:

[root@slackdell /]$ fsck /dev/hda1
fsck 1.35 (28-Feb-2004)
e2fsck 1.35 (28-Feb-2004)
/dev/hda1: clean, 11/3670016 files, 115174/7339618 blocks
[root@slackdell /]$

<EDIT>
Now: I think the cfdisk problem may be with the partitions overlapping - I'll shrink my swap down a little (my version of parted can't handle ext3 for some reason)

OK - Done:
Code:

[root@slackdell /]$ fdisk -l

Disk /dev/hda: 40.0 GB, 40000000000 bytes
16 heads, 63 sectors/track, 77504 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hda1  *          1      58251    29358472+  83  Linux
/dev/hda2          58252      76979    9438187+  83  Linux
/dev/hda3          76980      77504      264600  82  Linux swap
[root@slackdell /]$

That fixed the cfdisk problem </EDIT>
But what's up with LILO it still won't install...

abisko00 02-04-2005 11:52 AM

Why are you trying to write lilo on hda1? Your root filesystem (/) is on hda2 and lilo is still located in the MBR of hda (you said it's working, didn't you?). So what is the problem?

scuzzman 02-04-2005 12:17 PM

Never mind.. I had to use this:
Code:

lilo -A /dev/hda
This initialized the HDD for another MBR
Then, I could install LILO on /dev/hda1 with the lilo command

Just for the googler's - I did this through an Ubuntu live CD by mounting then chrooting to access my slackware partition(s).

I am now proud to say: I'm Windows FREE!

Thanks for all your guys' help :)


All times are GMT -5. The time now is 10:11 PM.