Formatting a new disk and MBR
Solution 1
On windows,
GUI
In Disk Management, right-click the disk you want to initialize, and then click Initialize Disk.
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
In command line, type
diskpart
. Next, select disk your ant to Initialize by typingselect disk <disk_number>
.Now bring disk online using
online disk
and then typeconvert <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
ordiskmgmt.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
andmkfs
commands don't touch the partition table – they create a new filesystem on the given partition (or, rarely, disk).
Related videos on Youtube
Mulligan
Updated on September 18, 2022Comments
-
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 Linuxfdisk
/cfdisk
?