LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-25-2004, 04:43 AM   #1
digitallinux
LQ Newbie
 
Registered: Jul 2004
Distribution: Mandrake 10
Posts: 8

Rep: Reputation: 0
Formatting and MBR Q's


I want to reformat my Linux drive so that I can use it for a Windows drive. But I cant see it in Win XP so how can I reformat it?

Also if I do will the Master Boot Record reset to normal instead of using LiLo?
 
Old 08-25-2004, 04:48 AM   #2
Thoreau
Senior Member
 
Registered: May 2003
Location: /var/log/cabin
Distribution: All
Posts: 1,167

Rep: Reputation: 45
/sbin/lilo -u in linux

or

make dos/win floppy. boot to it. type fdisk /mbr.

reboot.

I was contemplating not telling you btw. That's just wrong on alot of levels. But I'll get over it.
 
Old 08-25-2004, 05:04 AM   #3
digitallinux
LQ Newbie
 
Registered: Jul 2004
Distribution: Mandrake 10
Posts: 8

Original Poster
Rep: Reputation: 0
wrong? as in getting rid of Linux?

I just need the extra drive to save my current drive before it dies.

would it work if i used a XP boot cd? and can I plz have more info on the boot disk/cd plz
 
Old 08-25-2004, 06:33 AM   #4
myriad-zero
Member
 
Registered: Aug 2004
Location: /india/tn/chennai
Distribution: Debian
Posts: 38

Rep: Reputation: 15
To change a Linux partition to Windows ...

Use 'fdisk' to edit the partition table of your disk. Change the partition type of the victim partition from Linux (83) to Windows FAT32 (b). Reboot the computer and boot into Windows. Now the new drive will be listed in Windows. Format it and continue.
 
Old 08-25-2004, 01:48 PM   #5
digitallinux
LQ Newbie
 
Registered: Jul 2004
Distribution: Mandrake 10
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by myriad-zero
Use 'fdisk' to edit the partition table of your disk.
I get the use fdisk and the rest of it, but do you mean delete the current partion then re create it as Fat32? and will fdisk see it?

How do I get to fdisk on winxp machine? i know how to on other (95 etc) but not sure on an XP machine.

Thanx for the help! it is grately appreciated.
 
Old 08-26-2004, 02:07 AM   #6
myriad-zero
Member
 
Registered: Aug 2004
Location: /india/tn/chennai
Distribution: Debian
Posts: 38

Rep: Reputation: 15
You should use 'fdisk' under Linux. Use the command 't' to change the type. You need not delete and recreate the partition. You can change the type of a partition without deleting it.

HTH.
 
Old 08-26-2004, 02:51 AM   #7
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
In Windows XP and as admin, right click in the my computer and then select manage. You can then delete, create, and format partiitons. Though formatting FAT32 in Windows XP has limits with capacity. You will have to use Knoppix or use your Linux install CD to manually format the partition as FAT32 if it is larger than 32 GB. Windows 95 and Windows 98 does not have this problem.

The MBR does not change when you use linux fdisk. You have to manually fix it. If you have two hard drives, you can use dd to copy the MBR from the Windows drive to the Linux drive. To do this type "dd if=/dev/hda of=/dev/hdb bs=512 count=1" as su or root. The MS fdisk does not have an option to select a drive to fix the MBR, so you may run into a problem if you have an MBR virus. Be very careful with if and of when using dd. The /dev/hda and /dev/hdb are examples. Also dd will not fix the problem if you have an MBR virus on the Windows drive, so be careful.

You could just use CD-R to backup your documents, graphics, sound, and videos. Mandrake 10 comes with K3B to make writing to CD-R discs easier in Linux.
 
Old 08-26-2004, 06:20 AM   #8
digitallinux
LQ Newbie
 
Registered: Jul 2004
Distribution: Mandrake 10
Posts: 8

Original Poster
Rep: Reputation: 0
So as root in Linux type fdisk
Then change partition type to fat32 - problem is that its 200Gb so what could I do? but if I go into winodws would I be able to see it? If so I could then format it to NTFS which is what I need it in anyways.

Im still not clear on how to get the MBR back to normal without LiLo. What command would I need to execute in Linux.
 
Old 08-26-2004, 09:07 AM   #9
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,064

Rep: Reputation: Disabled
There should be a rescue-console or some such in WinXP when you start it from CD. Use the command line there to start the Win-program "fixmbr", that's all...
 
Old 08-26-2004, 10:11 AM   #10
dsegel
Member
 
Registered: Aug 2004
Location: Davis, California
Distribution: Gentoo, always Gentoo.
Posts: 159

Rep: Reputation: 30
You have to fix the MBR from the Windows side; you can remove lilo in linux, but you can't put a Windows bootloader back into the MBR without booting into Windows somehow (e.g. the Windows install CD in Rescue Mode, or a DOS boot floppy.)

The DOS command is 'fdisk /mbr' the Windows install disk rescue-mode command is 'fixmbr'.

Don't worry about the partitions under linux; once you've booted into Windows you can use the native Disk Manager to delete the existing partitions and create a new one using NTFS (this is what right-clicking on My Computer and selecting Manage will get you to - go to the 'Disk Management' section.)

Last edited by dsegel; 08-26-2004 at 10:14 AM.
 
Old 08-26-2004, 03:19 PM   #11
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
I do not want to yell but I guess I have to.

PLEASE READ MY POST AGAIN. THERE ARE INSTRUCTIONS HOW TO COPY THE MBR FROM YOUR WINDOWS DRIVE TO YOUR BACKUP DRIVE.

You do not have to use NTFS if your Windows XP drive is NTFS. You can use FAT32. Changing the type of partition will not work if the that partition is not the whole hard drive. Mandrake makes three partitions automatically not one or two.

If you do not have Norton Ghost, you can use System Rescue CD.

I'm getting tired of people ignoring my posts.

 
Old 08-27-2004, 05:27 AM   #12
digitallinux
LQ Newbie
 
Registered: Jul 2004
Distribution: Mandrake 10
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by Electro
I do not want to yell but I guess I have to.

PLEASE READ MY POST AGAIN. THERE ARE INSTRUCTIONS HOW TO COPY THE MBR FROM YOUR WINDOWS DRIVE TO YOUR BACKUP DRIVE.

You do not have to use NTFS if your Windows XP drive is NTFS. You can use FAT32. Changing the type of partition will not work if the that partition is not the whole hard drive. Mandrake makes three partitions automatically not one or two.

If you do not have Norton Ghost, you can use System Rescue CD.

I'm getting tired of people ignoring my posts.

plz calm down! im trying to get this exactly right rather than just rushing ahead and doing it then fucking it up and having no system left.

So by typing "dd if=/dev/hda of=/dev/hdb bs=512 count=1" at console while root it should copy the MBR so therefore the next time I boot I will not see the LiLo boot screen? it should in theory boot into Windows XP fine?

Also I didnt realise that windows could actually see the dirves.

Be patient becuase I really find this hard and I dont want to make mistakes.
 
Old 08-27-2004, 03:42 PM   #13
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Doing "dd if=/dev/hda of=/dev/hdb bs=512 count=1" will work. Though you have to plug in your windows drive for if and your Linux drive for of.

What the above does. It takes file or device /dev/hda and does a raw copy of the first 512 bytes and places it on /dev/hdb. The option count in dd only does one 512 byte of raw data. The MBR is located at the first 512 bytes. You can do search on the internet. Every site will tell the same command.

If you really want real world evidence, I did the same and it worked. Though I kinda did a stupid thing before I did dd by designated a drive letter for my second drive. Windows got screwed up. Just let Windows automatically set the drive letter or set the drive as master on the primary IDE channel. The easiest is just move the Linux drive to the master on the primary IDE channel after you done copying.

I suggest using System Rescue CD to clone your Windows drive to your second drive. You can use Norton Ghost if you have it.

Every expert makes a boot floppy just in case something bad happens, so I suggest making one in Windows.
 
Old 08-27-2004, 03:50 PM   #14
dsegel
Member
 
Registered: Aug 2004
Location: Davis, California
Distribution: Gentoo, always Gentoo.
Posts: 159

Rep: Reputation: 30
That command will copy the MBR from your primary master drive (probably C: in Windows) to your primary slave drive. If your system is booting from the primary master then it won't have any effect on what happens.

If you want to fix the MBR on your primary master you need to boot from the Windows install disk and run the fixmbr command.
 
Old 08-27-2004, 07:21 PM   #15
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
dsegel, did you read my post or you just skimmed it because I did say moving the linux drive (primary slave) to the primary master after copying. Though some motherboard manufactures add a few features to the BIOS, so you can boot to other hard drives instead of the first hard drive that is seen. In my BIOS I can select a few hard drives like HD0, HD1, HD2, etc to boot from.

Using fixmbr may not fix the linux drive, so that is why I suggest using dd before killing the Linux partitons. Also using fixmbr can screw up the hard drive if there is a MBR virus. Using fixmbr or fdiks /mbr should not taken lightly.

If you really want to get the copy done with out messing around with MBR and partitioning, you can use Knoppix and go into run level 3. Next type "dd if=/dev/hda of=/dev/hdb bs=512 conv=sync". That command then do a byte to byte copy of the whole entire Windows drive to the other other drive. It will do everything for you like the filesystem, partition table, and MBR, but it will not check for badblocks if it is on the Linux drive.
 
  


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
MBR zeroed. Can I verify backup MBR? TomF Linux - General 7 06-20-2005 06:28 PM
by tring to fix the MBR i damage the MBR that was help... AKAKAK Fedora 4 03-21-2005 09:18 AM
GRUB MBR overwritten by WIN98 MBR TOuseef Linux - General 7 11-14-2004 05:25 PM
New here and got some Q's chivas Linux - Newbie 8 03-19-2004 12:36 PM
problems with formatting second disc after removing grub from mbr aabeeikora Linux - Newbie 2 08-02-2003 03:05 PM

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

All times are GMT -5. The time now is 03:02 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration