Page 1 of 7 123 ... LastLast
Results 1 to 10 of 62

Thread: Partitioning and cfdisk how-to and how to ungoof your MBR

  1. #1
    Senior Member registered user
    Join Date
    Mar 2003
    Location
    colorado springs, colorado
    Posts
    1,933

    Partitioning and cfdisk how-to and how to ungoof your MBR

    Of course we first need to get the standard disclaimer out of the way: If you through the use of this document bork your hardware, software, dog, girlfriends goldfish or otherwise don't come crying to me! As always- BACK UP YOUR DATA FIRST!! Especially if you're considering repartitioning your hard drive.

    Also- this really belongs in the wiki but since I don't have time, patience or otherwise it would be fantastic if some kind soul could take the time to put it there.

    On with the show...........

    There is no great science to disc partitioning. A hard drive is actually two discs, one above the other with a gap of apporximately 1/4" seperating them. The 'heads' are little arms that move across all four disc surfaces from outer edge to inner edge and back. They write data to and read data from the disc in 'blocks'. Of course it's a little more complicated than that but that's enough for our intent. When you install windows it automatically makes a partition the size of the entire first hard drive and also formats the drive. Back when a big hard drive was less than 1 gigabyte that was ok- now they are comparatively huge and we can make much better use of disc space by partitioning.

    When you partition the disc you are dividing it into sections. Remember how vinyl LP's look? Cmon' now I know I'm not the only one who remembers LP's! You could see where each song started and stopped. This is much the same as hard drive partitions except that we must use a graphical representation of the partitions since we cannot physically see the partitions. For all practical intents and purposes you may think of partitions as seperate discs in and of themselves. They will be used as such. There are any number of partitioning programs out there. They all do the same thing. Some are easier than others. I would recommend using qtparted as it is a very easy to understand proram that graphically represents how your disc is partitioned and it is included with Knoppix.

    *NOTE*I have heard all sorts of stories about working w/ NTFS from Linux ranging from good to bad. Beware.

    Open a root terminal and do this:

    qtparted

    OR- open any terminal and do this:

    sudo qtparted

    This should open up qtparted. Go ahead and have a look- you won't hurt anything (just don't 'write' anything). It should show you all of your hard drives and how they are partitioned.

    *NOTE* There is still some question as to whether or not qtparted will work for resizing Reiser formatted partitions.

    There are several ways that Linux refers to drives. Fortunately this is slowly changing to one standard format called the device file system but we aren't there yet. Your drives are usually referred to like this:

    Primary Master- /dev/hda
    Primary Slave- /dev/hdb
    Secondary Master- /dev/hdc
    Secondary Slave- /dev/hdd


    Your first drive /dev/hda is usually a hard drive (except for diskless machines!). It is where the Master Boot Record is stored. The MBR contains quite a bit of info- specifically your bootloader which actually has two stages- primary and secondary. The primary bootloader does nothing more than start the secondary boot loader. The secondary boot loader boots the partition with your operating system on it. If you only have one bootable partition then that's fairly straightforward. However, if you wish to dual-boot then you will need a menu from which you can choose the partition you'd like to boot. While ntldr is capable of this it is not very user friendly to configure. LILO and GRUB (the most common Linux bootloaders) while functionally quite different from each other are both fairly easy to configure once you understand the basics-that is another how-to though.

    Partitioning:

    Each individual partition is numbered. First the disc name '/dev/hda' then the partition number '1,2,3' etc. This gives you /dev/hda1, (first hard drive first partition) /dev/hda2, etc. Another example: /dev/hdc5 (3rd drive 5th partition).

    The first four partitions of each disc are usually Primary partitions. Partitions 5-? are usually logical partitions. You could for example create two primary partitions. The first partition ( /dev/hda1 for example) does not need to be very large. 50Mb should do it. It will be a primary partition. Partition number two /dev/hda2
    can be any size you wish. Let's say we use the rest of the disc for this partition. We'll assume a total disc of 5000Mb (5Gigabytes) total space. /dev/hda2 will then be approx. 4950Mb (remember that the sizes won't be exact).

    *NOTE* Hopefully this does not confuse matters for you. If you only have two partitions, both will be primary. If you then create logical drives or extended partitions inside of partition #2 that partition will then change from #2 to #4. Why? Because partition #4 is the one that is usually used for logical drives.

    Logical Drives (extended partitions).

    Inside of /dev/hda2 (our second partition on the first hard drive) we will now create two Logical Drives. They will begin with?..../dev/hda5, dev/hda6, etc. Why? See the above paragraphs. You can make them any size you want as long as they fit inside the primary partition. Lets make our first logical drive 3000Mb. This is where we will install the /root directory.

    The second logical drive we will make 500Mb. This will be our swap partition.

    The 3rd logical drive we will make 1500Mb. This one could be used for our /home partition (refer to the Knoppix docs for a how-to on moving your /home partition).

    I personally prefer to use cfdisk to view, create and delete partitions. It is also used during the Knoppix install script so if you intend to install Knoppix it might be a good idea to familiarize yourself with cfdisk.

    You may use the above examples and sizes for a Knoppix hd-install. They should work just fine.

    Here is another example of a partitioned 20G drive:

    #: cfdisk /dev/hda

    Code:
    cfdisk 2.11z 
    
    Disk Drive: /dev/hda 
    Size: 20490559488 bytes, 20.4 GB 
    Heads: 255 Sectors per Track: 63 Cylinders: 2491 
    
    Name    Flags    Part    Type    FS    Type    [Label]    Size    (MB 
    
    
    hda1 Boot Primary Linux ext2 65.81 
    hda5 Logical Linux ReiserFS 1003.49 
    hda6 Logical Linux swap 1497.01 
    hda7 Logical Linux ReiserFS 1998.75 
    hda8 Logical Linux ReiserFS 1998.75 
    hda9 Logical Linux ReiserFS 3002.23 
    hda10 Logical Linux ReiserFS 3002.23 
    hda11 Logical Linux ReiserFS 5872.85 
    
    [Bootable] [ Delete ] [ Help ] [Maximize] [ Print ] 
    [ Quit ] [ Type ] [ Units ] [ Write ]

    Use the arrow keys to navigate through cfdisk. The options at the bottom are fairly self-explainatory but I'll give a brief description of each one:

    [Bootable]- marks a partition as 'bootable'. Note that only the first partition needs to be labeled as bootable IF YOUR BIOS CANNOT BOOT FROM BEYOND THE 1024 CYLINDER LIMIT OR YOU ARE USING NTLDR.
    [Delete]- just as it implies it will delete- without question any partition you choose.
    [Help]- take a guess.
    [Maximize]- An option to maximize the usage of the partition. You will likely never need to use this option.
    [Print]Not literally "send to printer" but print to file OR- for those of you that are curious print to screen-you can even choose the format. The following is [Print] [Sectors] to screen.

    Code:
    Partition Table for /dev/hda 
    
    First Last 
    # Type Sector Sector Offset Length Filesystem Type (ID) Flags 
    -- ------- -------- --------- ------ --------- ---------------------- --------- 
    1 Primary 0 128519 63 128520 Linux (83) Boot (80) 
    2 Primary 128520 4128704 0 4000185 Linux (83) None (00) 
    4 Primary 4128705 40017914 0 35889210 Extended (05) None (00) 
    5 Logical 4128705 6088634 63 1959930 Linux (83) None (00) 
    6 Logical 6088635 9012464 63 2923830 Linux swap (82) None (00) 
    7 Logical 9012465 12916259 63 3903795 Linux (83) None (00) 
    8 Logical 12916260 16820054 63 3903795 Linux (83) None (00) 
    9 Logical 16820055 22683779 63 5863725 Linux (83) None (00) 
    10 Logical 22683780 28547504 63 5863725 Linux (83) None (00) 
    11 Logical 28547505 40017914 63 11470410 Linux (83) None (00)
    [Quit]Just as it implies.
    [Type]With this option you can MARK any partition as a certain format type. THIS DOES NOT FORMAT THE PARTITION!! That is a seperate process to be completed later AFTER writing your partition table AND confirming the re-read of your partition table which may involve a reboot.
    [Units]Changes the format which your partitions are displayed. Your choices are Megabytes, Sectors or Cylinders. Stick with Megabytes unless you know what you are doing. It's much simpler.

    *NOTE* A Megabyte is 1024 Kilobytes. Therefor, in the above example /dev/hda10 is 3000 Mb OR 3Gigabytes.
    [Write]- Commits your new partition table to the hard drive.

    *REMEMBER* If you do not [Write] the partition table to disc nothing will be changed. When you do invoke the [Write] option cfdisk will tell you if it wrote successfully or not and if it succeeded in re-reading the partition table AFTER writing. If it fails to re-read the table you will need to reboot for the changes to take effect. If it successfully re-reads the partition table you should not need to reboot but if it makes you feel better by all means go ahead.

    So what are you waiting for? Go ahead, start cfdisk, create and destroy partitions at will- JUST DON'T WRITE ANYTHING! and you'll be fine-just [Quit] cfdisk. Learn your way around the program, what it can and cannot do and how it does it. When you're happy with your partitions you've created then go a head and write the partition table to disc.

    *REMEMBER* If cfdisk "failed re-reading partition table" then you MUST reboot before trying to format a partition!!

    "I goofed my MBR and now I can't boot windows!"

    Two things that are reported to work:

    1)Boot w/ win98 boot floppy, at the a: propmt enter:

    fdisk /mbr

    2)Boot w/ XP or WIN2k cd into recovery mode and run:

    fixmbr

  2. #2
    Member registered user
    Join Date
    Jul 2003
    Location
    Purgatory
    Posts
    33
    Ok, just one very simple question: During the hd installation and you've finished writing the partition table, how do you exit fdisk and get on with the rest of the installation? Because the only way I could see was by exiting the konsole and that exited the installation. Why it worked the third time, I've no idea.

  3. #3
    Senior Member registered user
    Join Date
    Mar 2003
    Location
    colorado springs, colorado
    Posts
    1,933
    On the hdd installs I've done you can just hit the 'Q'` key to quit cfdisk, or hit the [Quit] option, then it proceeds with the installation. You can also invoke a partitioing tool prior to installation, then run the installer and just quit out of the partitioning tool since you've already set up your partitions. It works the same either way.

  4. #4
    Junior Member
    Join Date
    Aug 2003
    Posts
    7

    re:

    I have partionmagic 7, can i partion the hd in partionmagic as wanted for a knoppix installation and start the installation, will the installer auto-detect the partions.

    Also on what type of partions can knoppix be installed on??

  5. #5
    Senior Member registered user
    Join Date
    Mar 2003
    Location
    colorado springs, colorado
    Posts
    1,933
    Sure you can use partition magic but I wouldn't recommend it. It seems to have made a mess of alot of hard drives lately. The latest Knoppix cd's have a better program called qtparted that does a much better job.

    The rule of thumb is: make dos partitions with dos applications and Linux partitions with Linux applications.

    Linux can be installed on ext2, ext3, reiser or xfs file systems. My personal recommendations are either ext3 or reiser as they are journaled file systems. In the event that your machine is shut down improperly you have a greater chance of recovering data with a journaled file system. xfs is fine too but you really won't realize any performance gains unless you're building a cluster or somesuch.

  6. #6
    Member registered user
    Join Date
    Jun 2003
    Posts
    32

    Re: Partitioning and cfdisk how-to and how to ungoof your MB

    Two things that are reported to work:

    1)Boot w/ win98 boot floppy, at the a: propmt enter:

    fdisk /mbr

    2)Boot w/ XP or WIN2k cd into recovery mode and run:

    fixmbr
    Yes, those will restore your original MBR... and sometimes the mapping from the MBR to the boot sector is messed up, too, so these two commands also help:


    Addition to #1: sys C:

    Addition to #2: fixboot

  7. #7
    Senior Member registered user
    Join Date
    Jul 2003
    Posts
    692
    I just did a dual boot HD install on an XP machine with two HDs. As someone suggested in another thread, my goal was to keep the C: drive (NTFS) as-is, and partition the other (G: ) drive for the Linux installation. I really, really tried to leave the C: drive MBR alone, with the idea of booting LILO or GRUB off the G: drive (after changing the boot order in BIOS), but somehow the step-by-step of the installation program erroneously assumed without asking that I wanted to d*ck around with the booting on C: . During the installation process, I noticed a menu item that said boot to hda1, and I quick changed it to hdb1 before I exited the program, but it apparently had already messed up the MBR on C:.

    As a result, on reboot, I got about five rows of "99999999999999999999" on my boot screen, along with a request to insert a boot disk. I restarted and selected the BIOS setup, and changed the HD boot order to boot off of G:, as I originally intended. So, now I'm in dual boot heaven, and all works well, but I'm afraid that if I ever remove the G: drive from my system, I'll be stuck with booting from floppy. So, to fix my C: drive MBR, since I'm still able to boot, it sounds like I need to do one of the following:

    1. Type sys C: from a DOS prompt
    2. Typex fixmbr at a DOS prompt
    3. Type fdisk /mbr at a DOS prompt
    4. Type fixboot at a DOS prompt

    Any recommendations as to which would be best, in the case of my XP NTFS disk?

  8. #8
    Junior Member
    Join Date
    Aug 2003
    Posts
    8
    Quote Originally Posted by j.drake
    So, to fix my C: drive MBR, since I'm still able to boot, it sounds like I need to do one of the following:

    1. Type sys C: from a DOS prompt
    2. Typex fixmbr at a DOS prompt
    3. Type fdisk /mbr at a DOS prompt
    4. Type fixboot at a DOS prompt

    Any recommendations as to which would be best, in the case of my XP NTFS disk?
    From what it sounds like to me you have 2 choices:
    sys C:
    fdisk /mbr
    from dos or

    fixmbr
    fixboot
    from xp's recovery console (this is not dos)

  9. #9
    Junior Member
    Join Date
    Oct 2003
    Posts
    1

    Fixing the Windows MBR from Linux

    If you have separate hard drives for Linux and Windows, you can fix the Windows MBR from within Linux.

    First, read Little White Dog's excellent how-tos for making a dual-boot Linux system. http://www.littlewhitedog.com/reviews_other_00011.asp
    http://www.littlewhitedog.com/reviews_other_00011b.asp

    Then (heresy here) burn/buy/borrow the first disk of Mandrake Linux (9.x) and follow these instructions:

    1. Boot from the Mandrake Linux installation CD.
    2. When the installation screen comes up, press [F1] to get to the repair options screen.
    3. Type "rescue" and press[Enter].
    One of the options will be to restore your Windows MBR.
    Choose it and follow instructions.
    4. Exit and reboot.

  10. #10
    Junior Member
    Join Date
    Oct 2003
    Posts
    12
    I was wondering, how easy/hard is it to safely resize an NTFS partition? I have two harddrives in my mom's machine. The second one is from before the motherboard blew a capacitor, and the first one is a fresh install of XP Home (both drives were XP Home). I don't wanna wipe the second drive because there may still be stuff on there that we need. My mom said, however, that if we don't touch that other drive for a certain period of time (she never specified), it can be wiped. But I'm impatient :P. So, I was wondering if it's possible to safely resize the NTFS partition and make it about 4gb smaller. I know that Mandrake 9.2 can do this, but I don't wanna get Mandrake just to install Knoppix or DSL. Knoppix says there's about 15.8gb free, Windows (when I can get it to read the drive) says there's about 16gb free. So giving 4gb to Knoppix wouldn't be all that bad. If it's possible to do this without losing any data, that would be great. Thanks.

    EDIT: Nevermind, my friend gave me a copy of Partition Magic 8 and it did the trick.

Page 1 of 7 123 ... LastLast

Similar Threads

  1. Replies: 11
    Last Post: 05-26-2004, 01:38 AM
  2. cFdisk
    By Mogiin in forum General Support
    Replies: 6
    Last Post: 08-26-2003, 07:33 PM
  3. cfdisk-explanation
    By senorian in forum Hdd Install / Debian / Apt
    Replies: 6
    Last Post: 05-20-2003, 03:38 PM
  4. Help with cfdisk
    By douglas2 in forum Hdd Install / Debian / Apt
    Replies: 1
    Last Post: 05-11-2003, 03:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


SanDisk 128GB Ultra Dual Drive USB Type-C, USB 3.1 Flash Drive - SDDDC2-032G-G46 picture

SanDisk 128GB Ultra Dual Drive USB Type-C, USB 3.1 Flash Drive - SDDDC2-032G-G46

$10.99



SanDisk 256GB Ultra Dual Drive Go USB Type-C Flash Drive, Black- SDDDC3-256G-G46 picture

SanDisk 256GB Ultra Dual Drive Go USB Type-C Flash Drive, Black- SDDDC3-256G-G46

$21.99



Cruzer Glide USB Flash Drive 128GB picture

Cruzer Glide USB Flash Drive 128GB

$12.99



SanDisk 32GB Ultra Drive Dual Go USB Type-C Flash Drive, Green - SDDDC3-032G-G46 picture

SanDisk 32GB Ultra Drive Dual Go USB Type-C Flash Drive, Green - SDDDC3-032G-G46

$8.99



64GB USB 3.0 Flash Drive USB Memory Stick High Speed Retractable USB Thumb Drive picture

64GB USB 3.0 Flash Drive USB Memory Stick High Speed Retractable USB Thumb Drive

$5.99



2TB USB 3.0 Flash Drive Memory Photo Stick for iPhone Android iPad Type C 3 IN1 picture

2TB USB 3.0 Flash Drive Memory Photo Stick for iPhone Android iPad Type C 3 IN1

$13.00



Type C USB 3.0 Flash Drive Thumb Drive Memory Stick for PC Laptop 512GB 1TB 2TB picture

Type C USB 3.0 Flash Drive Thumb Drive Memory Stick for PC Laptop 512GB 1TB 2TB

$10.30



Sandisk 16GB 32GB 64GB 128GB Cruzer Blade Flash Drive Memory Stick USB Lot Pack picture

Sandisk 16GB 32GB 64GB 128GB Cruzer Blade Flash Drive Memory Stick USB Lot Pack

$4.99



USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack picture

USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack

$353.99



LOT 32GB 64GB 128GB USB 3.0 Flash Drive Memory Stick Retractable Thumb Drive picture

LOT 32GB 64GB 128GB USB 3.0 Flash Drive Memory Stick Retractable Thumb Drive

$420.99