LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-16-2005, 07:37 PM   #1
bichenoubi
LQ Newbie
 
Registered: Jun 2003
Distribution: Mandrake 10.1
Posts: 24

Rep: Reputation: 15
Linux won't boot after playing with PartitionMagic


Hi,

All started when I wanted to give more space for my windows partition.
after some readings (NTFS resizing is better within windows) I decided to shrink (and move) some Linux partitions to give the left space to windows. I used Partition Magic as it was able to deal with Linux partitions.

After apppling the changes, Windows rebooted and all looked ok (in windows).

But now, Linux won't boot.
After selecting Linux in Lilo, Linux begin to load, but then stops.

Here's the output (self translated):

----

Verification of root filesystem
/dev/hda5: clean, 24957/130816 files, 87512/257032 blocks (check after next mount)...........OK

Re-mount of root filesystem in writing mode...........OK

Activation of swapping partitions (swap): swapon: /dev/hda7: Invalid argument...........FAILED

Verification of filesystem
fsck.ext3/dev/hda9: The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and really contains ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt and you might try running e2fsck with an alternative superblock: e2fsck -b 8193 <device>

: Bad magic number in superblock while trying to open /dev/hda9
/dev/hda8: recovering journal
/dev/hda8: clean: 2256/131072 files, 37222/255024 blocks (check after next mount)

The file system is corrupted. Do you want to repair errors ?

[Y]

fsck.ext3
The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and really contains ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt and you might try running e2fsck with an alternative superblock: e2fsck -b 8193 <device>

: Bad magic number in superblock while trying to open /dev/hda9
e2fsck 1.35 (28-feb-2004)
/dev/hda8: clean: 2256/131072 files, 37222/255024 blocks (check after next mount)............FAILED


----------



What fsdisk gives me:

-----------

Device / Boot / Start / End / Blocks / Id / System

/dev/hda1 * 1 1374 11036623+ 7 HPFS / NTFS

/dev/hda2 1375 3333 15735667+ f w95 Ext'd (LBA)

/dev/hda5 1375 1502 1028128+ 83 Linux

/dev/hda6 1503 1565 506016 82 Linux swap

/dev/hda7 1566 1947 3068383+ 83 Linux

/dev/hda8 1948 2074 1020096 83 Linux

/dev/hda9 2075 3333 10112886 b w95 FAT32


-----------


what lsparts gives me:

------------


hda1: 10,777 MBytes, type <0x7> (NTFS (or HPFS))

hda5: 1,004 MBytes, type <0x83> (Ext2)

hda6: 494 MBytes, type <0x82> (Linux Swap)

hde7: 2,996 MBytes, type <0x83> (Ext2)

hde8: 996 MBytes, type <0x83> (Ext2)

hde9: 9,875 MBytes, type <0xc> (win98 fat32, LBA-mapped)
---------------


So, I really don't know about table partition, so I don't really know what to do and I don't know why Linux (Mandrake 10.1) is not working...
I mean, does Linux has a different table partition and it doesn't know that my partitions have changed ?

Thanks a lot for your help.

Last edited by bichenoubi; 01-16-2005 at 08:55 PM.
 
Old 01-16-2005, 08:54 PM   #2
bichenoubi
LQ Newbie
 
Registered: Jun 2003
Distribution: Mandrake 10.1
Posts: 24

Original Poster
Rep: Reputation: 15
I just remembered that before doing that I created a rescue disk with Partition Magic. Would it solve my problem by revert everything back ?

If yes, one of the operations I did in all this process was to create a partition on an other hard drive, should I deconnect the HD if I want to keep that partition ? [Note that this issue is not related with my Linux problem, I just want an advice...]


Thanks
 
Old 01-17-2005, 01:41 AM   #3
stixoffire
LQ Newbie
 
Registered: Jan 2005
Posts: 2

Rep: Reputation: 0
Partitioning Advice

Ok - here is the scoop

LILO and GRUB have pointers to the block on the drive where to boot the PARTITION BOOT RECORD - each PARTITION has such a thing as a Boot Record - hence why one is called the Master Boot Record. Which version of Magic you are using I do not know but I would venture to say Version 5... I think 8 actually works.


With out getting into details - you should really look into boot loaders documentation all around the web and especially on linux sites - you will find a wealth of info ..to help you now and in the future.

Yes definitely disconnect the drive with the Partitions you want to keep ...
 
Old 01-17-2005, 04:52 PM   #4
bichenoubi
LQ Newbie
 
Registered: Jun 2003
Distribution: Mandrake 10.1
Posts: 24

Original Poster
Rep: Reputation: 15
I did it with PartitionMagic 8

Is there a way to simply repair the Partition boot record (or is it Lilo who need to be repaired ?) or create a new one that works ? (I'm not really sure what a partition boot record is)

I'm surely not the first who had problems like this, there should be relatively simple solution out there....? no ?
I'm not a Linux guru, nor a computer guru...

Thanks
 
Old 01-19-2005, 07:02 PM   #5
marco13185
LQ Newbie
 
Registered: Dec 2004
Posts: 21

Rep: Reputation: 15
Can you give us details of the resize (before and after data)? It would be very helpful if you did.

How much of the mandrake drive is in use (now, not before)? Go into google and type "ext3 in NTFS"

The reason for this being that partitioning software is VERY faulty when it comes to getting that data. It might have thought the mandrake partition was smaller that it actually was. Thus in your resize, you might have deleted important files vital to linux. If so that partition would be full.

I am not sure but I think linux drives might fragment (a problem for resizing). If so the same thing can happen.

Recovery disk probably wont cut it here, but a repair install might.

Everything in my post is based on computer knowledge not linux knowledge. I am a linux
 
Old 01-20-2005, 03:48 AM   #6
Rick485
Member
 
Registered: Sep 2003
Location: Arizona
Distribution: Kubuntu 8.04
Posts: 202

Rep: Reputation: 30
A Knoppix disk can be useful in emergency recovery situations such as this, if you have one. It is a version of Linux that runs entirely from a CD without being installed to your hard disk. As a test you could insert the Knoppix CD and boot up into Knoppix and then try to mount your various hard disk parititins and see if your data is still safe (it probably is). If you have a Knoppix disk (or any other similar live distro) we could tell you how to use it to mount your Linux partitions. That would not solve your problem but sucessfully mounting them from Knoppix and then testing them with e2fsck or fsck would show that the partitions are still ok. Having access to the partitions would also allow you to edit configuration files such as the lilo.conf or fstab file on hda5 if that is necessary.

I have used both Partition Magic and Partition Commader to resize NTFS, FAT32, FAT16, EXT2, EXT3 and Reiser partitions on both of my computers without ever having problems. Linux never became confused as a result of the changes. So anyway, I may be on the wrong track but here is my best guess about your problem:

How old is your computer? I may be wrong but, here is why I ask? Due to the limititations in the BIOSes of some older computers, it was sometimes necessary that the partition that holds /boot be located entirely below cylinder 1023. That was probably the case before you enlarged your Windows partition but (from what you posted above) does not appear to be the case any longer. Your first Linux partition which is hda5 now starts at cylinder 1375 and ends at cylinder 1502. On computers that have that limitation, it is still OK for other partitions to be above cylinder 1023 just not the one you are booting from. That is not a problem with most computers or either of my computers and on both of them the cylinder that that holds /boot and the kernel is above cylinder 1023.

Was the hda5 ext2 partition entirely or at least partially below cylinder 1023 before you enlarged the Windows hda1 NTFS partition? This source is somewhat old but here is what the original Red Hat 7.3 Installation Gude says on page 123:

" . . . the partition that holds /boot must be located entirely below cylinder 1023. If the partition holding /boot straddles cylinder 1023, you may face a situation where GRUB or LILO will work initially (because all necessary information is below cylinder 1023) but will fail if a new kernel is to be loaded and that kernel resides above cylinder 1023."

When I type the command "man fdisk" while running Slackware 10 Linux, there is one paragraph in the manual page for fdisk that also mentions the cylinder 1023 problem that some computers have. It mostly duplicates what I said above, so I will skip what it says but, anyone that has a working copy of Linux could look it up if they desire.

If you have a Linux boot floppy disk or a boot CD that has LILO or GRUB and also a kernel on it you should probably still be able boot up your the copy of Mandrake that is on your hard disk if it is uses a kernel that is on the CD or Floppy. Was a boot floppy created during installation? I am not sure if a kernel is usually included on the boot floppy disk or not? I have created GRUB boot CDs as a backup method of method for booting the various Linux distros on my two computers and did not bother including a kernel but the instructions I was following did mention how to do that (it can be done).

So anyway, if that was really the problem, one solution would probably be to use Partition Magic to shrink your Windows hda1 NTFS partition to back at least as small as it originally was. You could then resize your hda2 extended partition to where it touches the Windows partition again and then also move your hda5 logical partition which is inside the extended partition back down against the Windows partition. Basically, put things back like they were.

If it turns out that was the problem, you would probably like to find a better solution than keeping the Windows partition small. For computers that have that limititation the Red Hat 7.3 Installation Manual suggests creating a small /boot partition somewere below cylinder 1023. The old Red Hat 7.3 Manual suggests a seperate /boot partition of only 32 Mb. Unfortunately, you will probably want to give your main Windows partition everything below 1023 instead. Fortunately, you do already have a second hard drive so you could place a /boot partition on it that is below its cylinder 1023. If you eventaully find yourself needing to reinstall Linux, you might want to use GRUB instead of LILO this time. GRUB would probably not offer any advantages for a newbie in your situation but is does have various useful emergency options that can be accessed before you even try to start Linux or Windows. So anyway, what I described may or may not really be your problem.

Last edited by Rick485; 01-20-2005 at 04:05 AM.
 
Old 01-20-2005, 04:07 AM   #7
abisko00
Senior Member
 
Registered: Mar 2004
Location: Munich
Distribution: Ubuntu
Posts: 3,517

Rep: Reputation: 58
I once shrank my reiserfs partition with linux tools. One thing that I remember is that there were actually two shinking processes involved:

1. shrinking of the filesystem (in my case resize_reiserfs)
2. shrinking of the partition (I used cfdisk)

What I want to say with this: maybe PM did only shrink your partition, but not the filesystem. In that case, there is now part of the filesystem ending in empty space. I think it could be worth trying to revert the changes made by PM.

Correct me if I am wrong, this is just a guess without knowing anything precicely.

Last edited by abisko00; 01-20-2005 at 04:09 AM.
 
Old 01-20-2005, 08:11 AM   #8
0pal_t0ad
Member
 
Registered: Feb 2004
Location: Southampton, England
Distribution: Laptop:Gentoo-i686-2.6.9-r9 Desktop:Slackware10 2.4.26
Posts: 298

Rep: Reputation: 30
Re: Linux won't boot after playing with PartitionMagic

Quote:
Originally posted by bichenoubi

Activation of swapping partitions (swap): swapon: /dev/hda7: Invalid argument...........FAILED

Verification of filesystem
fsck.ext3/dev/hda9: The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and really contains ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt and you might try running e2fsck with an alternative superblock: e2fsck -b 8193 <device>

: Bad magic number in superblock while trying to open /dev/hda9
/dev/hda8: recovering journal
/dev/hda8: clean: 2256/131072 files, 37222/255024 blocks (check after next mount)

The file system is corrupted. Do you want to repair errors ?

[Y]

fsck.ext3
The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and really contains ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt and you might try running e2fsck with an alternative superblock: e2fsck -b 8193 <device>

: Bad magic number in superblock while trying to open /dev/hda9
e2fsck 1.35 (28-feb-2004)
/dev/hda8: clean: 2256/131072 files, 37222/255024 blocks (check after next mount)............FAILED
----------
What fsdisk gives me:
-----------
Device / Boot / Start / End / Blocks / Id / System

/dev/hda1 * 1 1374 11036623+ 7 HPFS / NTFS

/dev/hda2 1375 3333 15735667+ f w95 Ext'd (LBA)

/dev/hda5 1375 1502 1028128+ 83 Linux

/dev/hda6 1503 1565 506016 82 Linux swap

/dev/hda7 1566 1947 3068383+ 83 Linux

/dev/hda8 1948 2074 1020096 83 Linux

/dev/hda9 2075 3333 10112886 b w95 FAT32

your partition table has changed completely!
if you look at ur first error about mounting swap /dev/hda7 and take a look at what the partition ref really is from fdisk u'll see swap has changed to /dev/hda6!
so u'll have to use either a linux rescue disk or live cd, what ever u do, DO NOT use your PM8 rescue disk just yet!!

first get hold a live cd that'll give u read/write access to a hdd(i'm told knoppix std does, not sure though).
once you've booted to the cd u'll need to mount /dev/hda5 somewhere like /mnt/hda
then open a text editor and edit the /etc/lilo.conf file and change /dev/hda7 to /dev/hda6.

you'll also need to chroot into your system. i think the cmd looks something like this: '#chroot /mnt/hda /bin/bash'
once chrooted you need to run '/sbin/lilo'

and hopefully that should be problem solved.
 
Old 01-20-2005, 12:56 PM   #9
Rick485
Member
 
Registered: Sep 2003
Location: Arizona
Distribution: Kubuntu 8.04
Posts: 202

Rep: Reputation: 30
I did overlook the fact that it seems to be trying to find the swap partition on hda7 when it is really on hda6. I am not really sure exactly how that off by one error in partition numbering could have been occured unless possibly he is missing a partition or something? Some portions of his error message exceed what I currently know about Linux, there is still much that I do not know.

Yes, the ordinary version of Knoppix does give read write access to hard drive partitions and I have used it that way once before. If you use Knoppix or a Linux rescue CD to mount /dev/hda5 somewhere temporarily there is need to make an extra effort to not make the mistake of looking at the files on the CD and think that you are looking at the ones on you hard disk. I am not familiar with the chroot command, is the chroot command being used to avoid that problem? The Linux books I have do not even mention that command. It sounds like you are more familiar with this than I am.

With Knoppix running he could mount and his /dev/hda5 partition at /mnt/hda with these commands:

mkdir /mnt/hda
mount /dev/hda5 /mnt/hda

If I understand correctly, 0pal_t0ad suggested editing the lilo.conf file and changing /dev/hda7 to /dev/hda6. Can the swap partition location actually be specified from there? On my computer in Slackware 10 the lilo.conf file only says where the root partition is. Perhaps the swap location can be specified from that file. On my computer the /etc/fstab file seems to be what says where to find the swap file. Perhaps he should edit his /etc/fstab file (but not the one one the Knoppix disk). In there he could change it to say that his swap partition is on /dev/hda6 instead of /dev/hda7. If any other partitions are also in the wrong place, then what the fstab file says about their location would also need to be changed. If he is also missing an important partition that could be an even bigger problem.

But anyway, I am not sure if I totally understand all of his error messages. I need to go do some other things for a while now so you or someone else could probably advise him instead of me.
 
Old 01-21-2005, 02:28 PM   #10
0pal_t0ad
Member
 
Registered: Feb 2004
Location: Southampton, England
Distribution: Laptop:Gentoo-i686-2.6.9-r9 Desktop:Slackware10 2.4.26
Posts: 298

Rep: Reputation: 30
Quote:
Originally posted by Rick485

If I understand correctly, 0pal_t0ad suggested editing the lilo.conf file and changing /dev/hda7 to /dev/hda6. Can the swap partition location actually be specified from there? On my computer in Slackware 10 the lilo.conf file only says where the root partition is. Perhaps the swap location can be specified from that file. On my computer the /etc/fstab file seems to be what says where to find the swap file. Perhaps he should edit his /etc/fstab file (but not the one one the Knoppix disk). In there he could change it to say that his swap partition is on /dev/hda6 instead of /dev/hda7.
the only time i've ever used lilo was with redhat5!!! and that was the very first time i tried linux. I prefer grub, it's easier. You're right about the config/fstab though,i did a google search

Last edited by 0pal_t0ad; 01-21-2005 at 02:30 PM.
 
Old 01-21-2005, 08:53 PM   #11
bichenoubi
LQ Newbie
 
Registered: Jun 2003
Distribution: Mandrake 10.1
Posts: 24

Original Poster
Rep: Reputation: 15
wow, thanks a lot for your help.


First, I can't remember exactly, but before, my partitions were like:

hda1: 8,000 MBytes, type <0x7> (NTFS (or HPFS))
hda5: 1,500 MBytes, type <0x83> (Ext2)
hda6: 494 MBytes, type <0x82> (Linux Swap)
hde7: 4,000 MBytes, type <0x83> (Ext2)
hde8: 4,000 MBytes, type <0x83> (Ext2)
hde9: 6,000 MBytes, type <0xc> (win98 fat32, LBA-mapped)


My computer is like 4-5 years old.

I neither have a Knoopix Cd nor a Linux rescue disk
Lilo seems to be the default choice with Mandrake. Next time I install, I will try installing Grub instead.

I can still access my Linux Partition (I can even write to it) with Parition magic 8 in windows.


So here is my linux fstab

Code:
/dev/hda5 / ext3 defaults 1 1
/dev/hda9 /home ext3 defaults 1 2
/dev/hdc /mnt/cdrom auto umask=0,user,iocharset=iso8859-15,codepage=850,noauto,ro,users 0 0
/dev/hdd /mnt/cdwriter auto umask=0,user,iocharset=iso8859-15,codepage=850,noauto,ro,exec,users 0 0
/dev/hdb1 /mnt/mp3 ntfs defaults 0 0
/dev/hda1 /mnt/win_c ntfs umask=0,nls=iso8859-15,ro 0 0
/dev/hda6 /mnt/win_d vfat umask=0,iocharset=iso8859-15,codepage=850 0 0
none /proc proc defaults 0 0
/dev/hda8 /usr ext3 defaults 1 2
/dev/hda7 swap swap defaults 0 0
Here is my Lilo.conf

Code:
# File generated by DrakX/drakboot
# WARNING: do not forget to run lilo after modifying this file

default="linux"
boot=/dev/hda
map=/boot/map
keytable=/boot/qc-latin1.klt
prompt
nowarn
timeout=100
message=/boot/message
menu-scheme=wb:bw:wb:bw
image=/boot/vmlinuz
	label="linux"
	root=/dev/hda5
	initrd=/boot/initrd.img
	append="acpi=ht splash=silent"
	vga=788
	read-only
image=/boot/vmlinuz
	label="linux-nonfb"
	root=/dev/hda5
	initrd=/boot/initrd.img
	append="acpi=ht"
	read-only
image=/boot/vmlinuz
	label="failsafe"
	root=/dev/hda5
	initrd=/boot/initrd.img
	append="failsafe acpi=ht"
	read-only
other=/dev/hda1
	label="windows"
	table=/dev/hda
Thanks guys.


PS. All my important data is in my FAT32 windows partition, so I would not loose much thing except time by re-installing Linux.
Is it more easier and quick to do so or should I try to repair it by hand ?

Last edited by bichenoubi; 01-21-2005 at 08:55 PM.
 
Old 01-22-2005, 12:39 AM   #12
trempel
Member
 
Registered: Jan 2005
Location: B.C, Canada
Distribution: Mint 17.3
Posts: 131

Rep: Reputation: 15
I haven't read the entire thread si I don't know what's up, but I know for sure what you shouldn't do.

I lost my entire hard drive after I played with partitionMagic. The only thing that saved me was a downloaded file recovery program that I could run after putting the drive in a different comp with a working winXP.

what not to do: DO NOT RUN PART-MAGIC IN WINDOWS XP.
what to do: RUN PARTITIONMAGIC FROM THE BOOT DISK.when you first try to install Magic in winXP it will ask you if you want to make a boot disk. It will contain a usable version of magic that you can run from the boot disk. Not the quickest thing in the world but it's a lot less likely to completely screw you over.

Trust me, I've been there, done that.
 
Old 01-23-2005, 01:03 PM   #13
0pal_t0ad
Member
 
Registered: Feb 2004
Location: Southampton, England
Distribution: Laptop:Gentoo-i686-2.6.9-r9 Desktop:Slackware10 2.4.26
Posts: 298

Rep: Reputation: 30
Quote:
Originally posted by bichenoubi
PS. All my important data is in my FAT32 windows partition, so I would not loose much thing except time by re-installing Linux.
Is it more easier and quick to do so or should I try to repair it by hand ?
that's up to u
if you want to try the fix the problem then if, as u say u can, edit the swap part in fstab to read:
/dev/hda6 swap swap defaults 0 0
only thing is i'm pretty sure you'll need to run /sbin/lilo, if so, then you will need to re-install mdk or download knoppix.
 
Old 01-23-2005, 07:29 PM   #14
wini_g
Member
 
Registered: Jun 2003
Distribution: SuSE 11.0
Posts: 171

Rep: Reputation: 30
Actually it does boot ..but isnt able to mount one of ur swap partitions .... looks like a wrong fstab entry ..... should it get any worse testdisk is a great program .... saved me when I made the mistake of entering fdisk\mbr twice from a windows start disk .... it completly ruined my partition table ... so fstab I say .... & init 1 at boot prompt & maybe noswap or maybe swap=off boot-parameter .
:-)
 
Old 01-25-2005, 10:46 PM   #15
bichenoubi
LQ Newbie
 
Registered: Jun 2003
Distribution: Mandrake 10.1
Posts: 24

Original Poster
Rep: Reputation: 15
Hey guys, it works !
I only had to edit my fstab, which I did in windows through PM.
I changed hdX number to those that fsdisk gave me, rebooted in Linux and it worked.
It seems that when PM resized the partitions, it made some changes that resulted in different paritions numbers.

Thanks again, I will not have to reinstall.


I will go downloading Knoopix as soon as possible
And do a Linux rescue disk

Thanks again

Last edited by bichenoubi; 01-25-2005 at 10:48 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Uninstalling RedHat Linux 9.0 Using PartitionMagic asilentmurmur Red Hat 9 03-03-2005 01:12 AM
lose partitionmagic noel General 2 08-12-2004 06:58 PM
unable to boot after partitionmagic 7 dave37 Linux - General 7 01-15-2004 05:46 AM
Windows won't boot after partitionmagic Ulrik_Uppkastar Linux - Newbie 4 12-20-2003 06:46 PM
Keep clear of PartitionMagic if you like linux browny_amiga Linux - Software 9 09-22-2003 08:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration