LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-22-2005, 06:31 AM   #1
Drahcir
LQ Newbie
 
Registered: Jan 2004
Posts: 13

Rep: Reputation: 0
Unhappy Partition Troubles


I'm having some really horrible trouble with HDDs these last two days. It all started when one of two HDDs in my computer suddenly just died. I had another one lying around somewhere so I deciced to replace it with that. However the drive that died had my OS on it so I've been using Damn Small Linux to get everything I need off it.

Moving everything I need from partition to partition was really difficult. The partitons where NTFS which Damn Small doesn't write to it. So I've needed to create some FAT32 partitions to transfer the files over and reinstall Windows XP.

I had created the FAT32 partitions using cfdisk and used mkdosfs to format them. While I can't be entirely sure, I think that mkdosfs has a bug. I currently have all the files I need on the NTFS and a FAT32 partiton. All that's left to do is, resize the NTFS partition, move the files from FAT32 to NTFS partitons and then delete the now unused FAT32 partitions.

My trouble is that both programs I have tried; cfdisk & Partiton Magic 8 both won't read the partiton table because it seems to be messed up (which I think was caused by mkdosfs). However both Linux and Windows can detect, read and write to the partitons.

Code:
Disk /dev/hda: 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/hda1   *           1        1155     9277506    7  HPFS/NTFS
/dev/hda2            7180        9729    20482875    c  Win95 FAT32 (LBA)

Disk /dev/hdb: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdb1   *        6135        9965    30769263    7  HPFS/NTFS
/dev/hdb2            3703        6135    19531008    c  Win95 FAT32 (LBA)
Partition 2 does not end on cylinder boundary.
/dev/hdb3            1272        3703    19531008    c  Win95 FAT32 (LBA)
Partition 3 does not end on cylinder boundary.
That's my output of fdisk -l.

All I trying to do now is to delete the partitions hdb2, hdb3, resize hdb1 because hdb2 is in it's way, move the files from the hda2 to the now larger hdb1 & then delete hda2, hdb2 & hdb3.

The message that cfdisk /dev/hdb is giving me is:
Code:
     FATAL ERROR: Bad primary partition 0: Partition ends after end-of-disk
                          Press any key to exit cfdisk
Anybody know how to fix this? I've tried everything I can think off that won't cause any data loss. I really don't want to lose any thing on hdb1! I don't any places to make a backup either. A huge thanks to anybody who replies.

Last edited by Drahcir; 12-22-2005 at 06:33 AM.
 
Old 12-22-2005, 09:47 AM   #2
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
OK I have a go at this.

1st advice is please don't use Partition Magic with Linux partitions. The damage is usually caused by the PM as it doesn't fully support Linux but always offers to fix things that it can't understand and beyond its ability. I never allow it to fix what it calls "errors" and I have over 120 partitions in 4 disks.

The cfdisk program is more sensitive to erroneous partitions and would abandon the disk very quickly. However the fdisk in Linux is more robust. It should still run and so with it you can delete hdb2 & hdb3. I advise you to reboot the PC every time you alter its partition table.

The removal of these partitions may just be enough to make cfdisk read your disk again, signifying the disk is healthy again.

Your two disks are in a bit of a mess. hda has a big empty gap between block 1156 and 7179. I think in fdisk you can artificially alter it.

One word of advice on partition table is that the internal data of the partitions never changed. The partition table is just the door bells system of a large apartment block. You can demolish the partition table completely without affecting the data residing in the partitions. I have rebuilt my hda and hdc about a dozen times and there are 60 and 54 partitions in them respectively. Don't think I ever lost a partition from a re-build yet. Naturally you keep a copy of your partition table for going back to do this sort of things.

The way you end up with hdb1 in the last part of the disk is because you may have been creating and deleting partitions without knowing their behaviours. Keep an eye on cfdisk as it is the best partitioning program showing everything while it happens.

Not rebooting immediate after a partition table change and trusting PM's word are the two most common causes of introducing corruptions in the partition table.

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

If you want to save hdb2 and hdb3 then use fdisk to set the cylinder in continuation instead of overlapping at a common point.

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

I don't think there is a bug in mkdosfs program. You should read cfdisk or fdisk screen after you carry out partition changes. It always remind you to reboot whwnever you alter a Dos partition!
 
Old 12-22-2005, 06:31 PM   #3
Drahcir
LQ Newbie
 
Registered: Jan 2004
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks for your reply Saikee. I've managed to delete both the hdb2 and hdb3 partitons using fdisk, however cfdisk still isn't working. I can see what my trouble is now but I have don't know what caused it too be like this in the first place.

I suppose it's worth mentioning that the basic layout of the disk before this mess started.

hdb1 was already on the drive before I reused it and contains some files that I need. It started at the very start of the drive and was about 30-40GB if I remember correctly. It was (NTFS)
I created hdb2 (now hdb3 for some reason) as FAT32 at the end of hdb1 for moving files from the partiton on hda (NTFS) that I was about to delete.
I realized that I there wasn't enough space left so I created hdb3 (now hdb2) at the end of hdb2 with the same filesystem and space.

I think I could fix it by just adjusting the start and end values of hdb1 partition, but isn't this dangerous? Both Windows and Linux can appear read and write to the partitions they can just fine and I really don't want it to become any worst.

Thanks again to any replies.
 
Old 12-22-2005, 07:33 PM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
The ending cylinder according to fdisk has been exceeded by one so I don't see any more damage can be made. However it is always prudent to backup the data first.

The way you have created hdb1 makes it extremely difficult to rebuild the partition table because you have to be dead accurate with the starting cylinder.

Normally it pays to do a 20000Mb, 10000Mb or 5000Mb partitions and stick with cfdisk. Your problem can disappear by simply delete all the bad partitions and rebuild the partition table by re-entering the recorded sizes. Your problem is your hdb1 doesn't start at the beginning of the disk.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Partition troubles NirvanaII Linux - Newbie 7 06-03-2005 10:28 PM
Partition Troubles bogey General 3 02-04-2005 11:34 AM
Partition troubles RockHound Linux - Hardware 2 03-07-2004 02:11 PM
Partition Troubles Acid0G Linux - Newbie 3 02-21-2003 01:35 PM
partition troubles Jedi Linux - General 15 11-14-2002 04:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:45 PM.

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