Formatting a new disk and MBR

9,518

Solution 1

On windows,

  • GUI

    1. In Disk Management, right-click the disk you want to initialize, and then click Initialize Disk.

    2. In the Initialize Disk dialog box, select the disk(s) to initialize. You can select whether to use the master boot record (MBR) or GUID partition table (GPT) partition style

  • Command Line

    1. In command line, type diskpart. Next, select disk your ant to Initialize by typing select disk <disk_number>.

    2. Now bring disk online using online disk and then type convert <mbr/gpt> to Initialize its partition table.

Note: if you get and error Initializifn try clearing its current attributes by typing `attributes disk clear'.

On Linux,

  • GUI

In gparted, select the disk you want to perform your action on. Now, select device > Create partition Table. Select your partition table of choice and apply it.

  • shell/cli

You need parted for this. In parted, select your disk by typing parted /dev/<disk_name> (use fdisk -l to find your disk name) and then mklabel msdos to convert to MBR

NOTE: CHANGUNG YOUR PARTITION TABLE IS DANGEROUS AND CAN CAUSE PERMANENT LOSS OF DATA. PROCEED WITH CAUTION. MAKE SURE YOU HAVE BACKUPS OF DATA BEFORE FORMATTING. MAKE SURE YOU HAVE SELECTED THE RIGHT DISK BEFORE FORMATTING. DAMAGE COULD BE IRREVERSIBLE.

Solution 2

That's close, but not entirely accurate.

  • The partition table is created by fdisk on MS-DOS, diskpart or diskmgmt.msc on Windows, fdisk, parted, gdisk on Linux, and so on.

  • The bootstrap code is usually written by a separate tool, usually by the OS installer itself (or by tools like grub-install). Even though BIOS bootstrap code happens to live in the MBR alongside the partition table, it's still a separate item. (UEFI boot code exists as files in a partition, for example.)

  • The format and mkfs commands don't touch the partition table – they create a new filesystem on the given partition (or, rarely, disk).

Share:
9,518

Related videos on Youtube

Mulligan
Author by

Mulligan

Updated on September 18, 2022

Comments

  • Mulligan
    Mulligan over 1 year

    Having a brand new disk am i right that MBR and bootstrap code is created by the formatting tool such a DOS format or Linux fdisk/cfdisk?