• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Puzzling partition problem

Zelmo3

Senior member
Long story short:
My primary IDE drive somehow has an extended partition as its first partition, which houses two logical partitions that hold all of the stuff I don't want to lose (everything else on the computer can vanish for all I care). The MBR is broken and can't be fixed by WinXP nor by GRUB.
Booting the WinXP CD into rescue mode will let me partition as I please (including another hard drive that now has nothing on it) and will format a disk with NTFS. I tried to format the black drive with FAT32, but Linux fdisk still reports it as HPFS/NTFS.
Booting a Linux setup CD will also let me partition as I please and will format a disk with any of a number of standard Unix-type filesystems.
My dilemma is that I want to safely move the stuff from my two important partitions to the blank disk so that I can wipe clean the primary disk and properly partition it, but WinXP's copy command doesn't accept wildcards and doesn't copy directories (and when I try to make new directories on the blank drive it tells me "Access denied"), and Linux can't write to NTFS-formatted disks.
Is there a way out of this quandary? As it is, I can't boot any installed system because of the broken MBR.
 
have you tried fdisk on it? (fdisk /mbr)

If not fdisk you could always zap it (search the web for "zap"), assuming there isnt physical damage to the drive zap will clear it out so that you can repartition/format it however you please.
 
Ok. You have 2 disks. One is has all screwed up partitions and the other disk is a blank disk you tried to format as Fat32.

Then you want to copy all the files from one disk to another so you can properly partition the disk with the important data.

Ok we will assume that the partition screwed up disk is the primary master disk (hda) and the second disk is the secondary master (hdc)


Go get the Linux CD and boot it up. Get to a command line. Probably crtl+alt+Fn were Fn=F2 thru F6

cfdisk /dev/hda

Write down the partitions names. If /dev/hda1 is a extended partition then you won't see it, it should only show logical and primary(real) partitions. If you see it, don't worry about it, if it's /dev/hda1 then it's /dev/hda1.

Then just exit out of it without changing anything.

Then:
cfdisk /dev/hdc

And see what partitions you want to right too. Write down those names too. I'll assume it's /dev/hdc1

Now the "type" of partition is a couple bits that sets what the bios sees. It can be ext2 or fat16 or fat32 or ntfs. This type doesn't have anything realy to do with anything. You can format it whatever you want (except for linux and linux swap types that can be important), but if you want to you might as well change the partition type to "w95 fat32" so that mount has a easier time dealing with it.

Go ahead and save the changes and exit out of cfdisk.

Try to mount it now and see if it thinks that it still is ntfs. You can specify the file type by using "mount -t vfat blah blah blah..."

If that didn't do the trick and you don't have anything on /dev/hdc1 yet then we can use linux tools to format it.

mkfs.vfat /dev/hdc1

will format /dev/hdc1 with the fat32. Sometimes they don't have mkfs.vfat and it's just mkfs. Then in that case "mkfs -t vfat" = "mkfs.vfat"

Then if that all works. Then we will make 2 directories:
mkdir /mnt/drive1
mkdir /mnt/drive2


Then we go

mount /dev/hda1 /mnt/drive1 (or whatever /dev/hda* partition you want to copy from)
mount -t vfat /dev/hdc1 /mnt/drive2

then we use the cp command (if you use move (mv) then it's kinda dangerous since it deletes the original copy)

cd /mnt/drive1
cp -a * /mnt/drive2/

Then that should make a copy of the entire contents of the first drive on the second.

And then double check you have all your information in perfect shape and everything worked out ok. You have to extra carefull because Fat32 and NTFS don't support permissions and stuff that Linux uses, so that sometimes funny things can happen. But if you double check everything (like reboot and make sure that you can still see the information) then that leaves little chance for something to go wrong.

Whala! 😛

BTW

You can use the DD command to safely (sorta safely) to wipe out a bad MBR.

dd if=/dev/zero of=/dev/hda bs=512 count=1

All the MBR REALY is is just the first 512 bytes on the beginning of a harddrive, nothing more special then that.

That command obliterate the first 512 bytes by overwriting it with zeros. (fdisk /mbr only formats the parts that dos uses for booting... this can be incomplete fix if the MBR is truly corrupt)

That should give you a chance to use the windows repair or grub/lilo stuff to construct your self a new MBR.

If you just want to wipe out a entire drive then just go:

dd if=/dev/zero of=/dev/hda

So using the dd command can be pretty dangerous if something goes bad. That's why you should back up your info first.

becaufull not to mix up your /dev/hda1 /dev/hdc1 /dev/hda /dev/hdc stuff!!!
 
Looks like fdisk /mbr doesn't work with XP's rescue mode.
BTW, I can't really use any tools from the internet because my comp has no network drivers until I can boot into an installed OS. 🙁
 
A million thanks Drag! I'm as far as copying everythin to the blank drive now, so hopefully when that's done I can set everything straight.
I did run into a couple of snags along the way. cfdisk (which is a new one for me) gave me an error message about a logical partition extending beyond its boundaries or something, so I used fdisk to fix that.
Then mkfs.vfat (which is also new to me, didn't know Linux could format vfat) had a partition size limit. The help file wasn't much help, and I don't have man files at my immediate disposal. Luckily I google the question and it had been answered elsewhere, so I got the drive formatted (in a few seconds, too, rather than the 1/2 hour that WinXP takes!).
I just hope that when all this is done, WinXP's fixmbr works properly. Otherwise I'm going to have to find out how to tell GRUB that there's a Windows installation on my PCI RAID card!
 
Originally posted by: Zelmo3
Looks like fdisk /mbr doesn't work with XP's rescue mode.
BTW, I can't really use any tools from the internet because my comp has no network drivers until I can boot into an installed OS. 🙁
yes you'd need a boot disk that has it, you can find one on www.bootdisk.com
 
Well, now I'm stuck again. Apparently the fixmbr command didn't do any good, because the system won't boot from the hard drive. Like I said, WinXP is on a PCI RAID controller. Is there a way to get Windows' MBR working on the primary IDE and boot XP from the RAID controller (like it did when I first installed XP), or am I better off reinstalling Linux on my newly cleaned IDE0 and having GRUB find the RAID?
 
Back
Top