LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-07-2003, 12:31 AM   #1
funtoos
Member
 
Registered: Jun 2003
Location: US
Distribution: Gentoo x86/AMD64, KDE 4.13
Posts: 38

Rep: Reputation: 25
FDISK : problem me or a bug?


I have dual boot linux RH8 and w2k setup. I had this FAT32 partition which I wanted to convert to EXT3. I did fdisk, typed p for info, typed t to change the partition type to linux. Did "mkfs -t ext3 <>". Mounted the partition. Everything went fine. I could use it.

But then, I booted into w2k. Took looooong time to boot, warned about chdsk needed to be run on a volume. I had forgotten that that partition was mounted as D: in w2k. w2k was un-usably slow. So, I deleted the logical drive from w2k with disk mgmt. The disk space became free and D: no longer existed.

Went back to linux, it of course cribbed about partition mount because w2k had just screwed it. Created a new partition from the free space. Linux was back as it was before. Now I booted back in w2k. It still said that the FAT32 volume had problems. Took long to boot. Any disk tools took forever to load. No reference to D: in explorer. I found the volume which it cribbed about during boot in the registry under HKLM\...\MountedDevices alongwith other usual suspects. Thinking that it will correct, I deleted that entry and booted again. Same cribs. It had created another entry with a different label in registry with the same value.

Another thing is that even norton ghost reports it as FAT32 partition. But can't do anything with it beyond that. Only linux believes that its EXT3 partition and is happily living with it.

Right now I can't use w2k, its too damn slow because it keeps looking for this volume which is not it's anymore.

How do I make w2k not look for that volume? Any help will be appreciated.
 
Old 08-07-2003, 10:06 PM   #2
funtoos
Member
 
Registered: Jun 2003
Location: US
Distribution: Gentoo x86/AMD64, KDE 4.13
Posts: 38

Original Poster
Rep: Reputation: 25
OK, can somebody help me please?

More troubleshooting done. I went ahead and deleted the partition from linux again. Rebooted. Booted into windows. Booted fine, no hang ups, showed the space as free. Booted again into w2k, just to make sure it was fine. It was. Went back into linux and created the partition, re-booted. Then booted into w2k. Again the same problem, it thinks that there is a FAT32 partition and starts to correct it, while it is actually an EXT3 partition.

any idea?
 
Old 08-07-2003, 10:18 PM   #3
funtoos
Member
 
Registered: Jun 2003
Location: US
Distribution: Gentoo x86/AMD64, KDE 4.13
Posts: 38

Original Poster
Rep: Reputation: 25
another thing I noticed just now is that if I mount with

$ mount /dev/hda7 /installs

it mounts it as vfat and is read-only. With

$ mount -t ext3 /dev/hda7 /installs

it mounts it as ext3, read-write and creates lost+found folder etc. like normal ext3 partition.

Its bizzare! Can somebody explain?
 
Old 08-08-2003, 03:37 AM   #4
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Some good times there eh? Any chance of chopping it out completely from w2k, or do you only have the choice to format it Fat32/NTFS? If you can chop it out, make it invisible, that'd be good.

Then go into linux (or even if you can't..) and just delete the partition. Don't "t" to change the type, but rather "d" to delete it, then "n" to create a new one, and finish out the rest of the operation.

Post up what you get from:
fdisk -l
As well. Tell us a bit about your drive layout/desires.

Cool
 
Old 08-08-2003, 11:27 AM   #5
funtoos
Member
 
Registered: Jun 2003
Location: US
Distribution: Gentoo x86/AMD64, KDE 4.13
Posts: 38

Original Poster
Rep: Reputation: 25
I had used 'd' to delete and 'n' to create last two times. The problem is when I delete the partition from linux, w2k is very happy and reports it as free space, no problem. But when I re-create the partition with 'n', it starts seeing it as a FAT32 partition. after "mkfs -t ext3 /dev/hda7", linux 'mount' mounts it as vfat by default but as ext3 with "-t ext3", which is bizzare to say the least.

here is the fdisk -l,

---------------------------------------------
# fdisk -l

Disk /dev/hda: 240 heads, 63 sectors, 5169 cylinders
Units = cylinders of 15120 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 815 6161368+ 7 HPFS/NTFS
/dev/hda2 816 1018 1534680 83 Linux
/dev/hda3 1019 1560 4097520 83 Linux
/dev/hda4 1561 5169 27284040 f Win95 Ext'd (LBA)
/dev/hda5 1561 1695 1020568+ 82 Linux swap
/dev/hda6 2847 5169 17561848+ c Win95 FAT32 (LBA)
/dev/hda7 1696 2846 8701528+ 83 Linux

Partition table entries are not in disk order
-----------------------------------------------

Its ugly, isn't it?

With this layout, w2k takes loooong to boot, any disk utility takes forever to load.

If I delete 7, the last entry disappears and everybody is happy.

forgot to mention that 7 was originally FAT32.

Last edited by funtoos; 08-08-2003 at 11:53 AM.
 
Old 08-08-2003, 04:48 PM   #6
Corin
Member
 
Registered: Jul 2003
Location: Jette, Brussels Hoofstedelijk Gewest
Distribution: Debian sid, RedHat 9, Suse 8.2
Posts: 446

Rep: Reputation: 31
From the manual page of fdisk

The bottom line is that if you use cfdisk or fdisk to change the size
of a DOS partition table entry, then you must also use dd to zero the
first 512 bytes of that partition before using DOS FORMAT to format the
partition. For example, if you were using cfdisk to make a DOS parti-
tion table entry for /dev/hda1, then (after exiting fdisk or cfdisk and
rebooting Linux so that the partition table information is valid) you
would use the command "dd if=/dev/zero of=/dev/hda1 bs=512 count=1" to
zero the first 512 bytes of the partition.

BE EXTREMELY CAREFUL if you use the dd command, since a small typo can
make all of the data on your disk useless.
 
Old 08-08-2003, 06:07 PM   #7
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Cool I was unaware of that, thanks Corin!

As a secondary 'follow-up' make sure your fstab isn't trying to mount it as fat32 still

Cool
 
Old 08-08-2003, 06:21 PM   #8
funtoos
Member
 
Registered: Jun 2003
Location: US
Distribution: Gentoo x86/AMD64, KDE 4.13
Posts: 38

Original Poster
Rep: Reputation: 25
Corin,

I had read about it in the man page, but I don't see how that applies to my situation. I never created a DOS partition from linux. All the fat32 and win95 partitions you see above were created before linux was installed.

Can you please elaborate as to how this applies to this situation? And which parition do I make the first 512 bytes zeroes of?

Thanks.

Last edited by funtoos; 08-08-2003 at 07:19 PM.
 
Old 08-08-2003, 07:22 PM   #9
Corin
Member
 
Registered: Jul 2003
Location: Jette, Brussels Hoofstedelijk Gewest
Distribution: Debian sid, RedHat 9, Suse 8.2
Posts: 446

Rep: Reputation: 31
Quote:
I had this FAT32 partition which I wanted to convert to EXT3.
FAT32 is in the category of DOS 6 partitions mentioned on the man page. So you modified a DOS6 partition.

I'm not 100% sure that this does apply, but let me explain what I think may have been the problem.

Using fdisk you converted the FAT32 to type ext3 and then did an mk2efs on that partition.

In the partition table there is enough information to tell linux that it is an ext3 partition, so everything is sweetness and light.

When you went back to Windoze, the Windoze system reads the partition table and looks for more information than is used by linux or is written by FDISK. The size of the partition is contained in there as well. Let me illustrate very crudely

Partition table info -- purely illustrative -- highly inaccurate
<-----------------------------512 bytes--------------------------------->
before <this is a FAT32 partition><size of partition><who knows what else other info>

fdisk merely changes this to
after <this is ext3 parition><this is same as above><this is same as above>

So Windoze sees some strange information about ext3, but the
rest of the size of the parition info is still intact and anything else

So being clever, it tries to repair it.

A better example is when you try to resize a partition with fdisk eg
before : hda1 8 GB
fdisk change to 4 GB
mkdosfs
linux reports file system size as 4 GB

Go back to Windoze, and it will tell you the size is 8 GB
If you try and use it, Windoze will overwrite files in your ext3 filesystem.
Use Format C: and it will format it as 8 GB

This is why you have to use dd to wipe out that other Windoze related information in the partition table information.

The only reason I know about this, is because I found out by hard experience .... :+}

So what you need to do is,

1) do you have any vital data on the parition which you converted
from FAT32 to ext3?

2) if so and you are runnign windoze, stop immediately and
boot into Linux

3) backup those essential files from that partition to another
using tar

4) umount the problem partition

5) dd if=/dev/zero of=/dev/hd<problem partition> bs=512 count=1

6) mke2fs -j -L parition_name /dev/hd<problem_partition>

7) fsck /dev/problem_partition

8) mount /dev/problem_partition

9) unpack your tar archive of vital data

10) hopefully everything should be okay now
even with Windoze not trying to mess around with it
 
Old 08-08-2003, 07:52 PM   #10
funtoos
Member
 
Registered: Jun 2003
Location: US
Distribution: Gentoo x86/AMD64, KDE 4.13
Posts: 38

Original Poster
Rep: Reputation: 25
Now thats a good enough explanation!!

I have one doubt with your instructions.

You are saying:

-------------------
Backup.
Leave the linux partition table as is.
Unmount.
Wipe the 512 bytes.
mkfs to format as ext3.
Mount.
Restore the data.
Now free to go to windows.
-------------------

Is that it or some reboots required in between? I have become paranoid now, so please understand. And thanks for your time in responding, you have been great!
 
Old 08-08-2003, 10:59 PM   #11
funtoos
Member
 
Registered: Jun 2003
Location: US
Distribution: Gentoo x86/AMD64, KDE 4.13
Posts: 38

Original Poster
Rep: Reputation: 25
Corin, I can't thank you enough! You rock my friend!

It corrected the problem. Windows boots great and works like before. Linux is happy as always.

One quirk: I typed /dev/hd7 instead of /dev/hda7 with 'dd' command, after MUCH checking and being VERY careful. I mean what is it? When things have to go wrong, they do go wrong. I almost fainted after hitting enter. But lucky for me, there is no device by that name. It just created a 512 bytes file /dev/hd7.

O Man! This has been a very tense evening. I need to chill out with some beer!

You have been great, my friend!!

Thanks to masterC too for participating.
 
Old 08-08-2003, 11:17 PM   #12
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
I was just a side act, Corin was the main event Thanks for the info Corin

Cool
 
Old 08-09-2003, 10:04 AM   #13
Corin
Member
 
Registered: Jul 2003
Location: Jette, Brussels Hoofstedelijk Gewest
Distribution: Debian sid, RedHat 9, Suse 8.2
Posts: 446

Rep: Reputation: 31
No problem at all. Glad to be of help.

As I said, the reason one gets to know about these things is not by just sitting down an reading throught a book "Linux in 24h' or the man page or whatever, but by actually coming face to face with a problem and [ ]in desperation[/i] trying to solve it (as I did when I shrank my FAT32 winC partition and Windoze kept telling me it was still the same size) :+)

However, it does pay to read what programs tell you, since when you use FDISK it does exit with the warning about

"if you have modified any DOS partitions, then check the man page"

And with regard to dd, it is absolutely essential to check and double check what one has written since

dd if=some_device of=/dev/hda{wrong_number} ... other options or not..

can in one step wipe your entire {thesis, web pages, collection of hours of downloading time of MP3s, movies whatever}.

But of course, you do have backups? :+)

So as the man page says, exercise extreme caution when using dd.
 
Old 08-09-2003, 12:30 PM   #14
funtoos
Member
 
Registered: Jun 2003
Location: US
Distribution: Gentoo x86/AMD64, KDE 4.13
Posts: 38

Original Poster
Rep: Reputation: 25
backups are fine but still a pain. during that 'faintout' period I was already thinking of tough times ahead restoring from backups. But I lucked out in the end.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
weird fdisk problem (Fdisk unable to see winxp partitions) khidot Slackware - Installation 5 04-07-2007 09:26 PM
Problem with fdisk junwen Linux - Newbie 7 02-20-2005 05:09 PM
workaround for parted bug using fdisk and resize2fs carneros Linux - Newbie 2 10-05-2004 12:52 AM
working around PARTED bug 90894 using fdisk and resize2fs carneros Red Hat 0 07-29-2004 02:42 PM
Problem using fdisk? cgsm Linux - Newbie 1 08-23-2003 08:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:00 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