Hot answers tagged

89

You can use parted -l to determine the type of partition table. Eg: $ sudo parted -l Model: ATA TOSHIBA THNSNS25 (scsi) Disk /dev/sda: 256GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 4194kB 32.2GB 32.2GB primary ext4 boot 2 32.2GB 256GB 224GB ...


33

On linux, you can check this via the gdisk tool which should be available for any distro. gdisk -l /dev/sda Here, /dev/sda is the device node of the physical drive, not a partition (/dev/sda1, /dev/sda2, etc. are partitions). If you see something that includes: *************************************************************** Found invalid GPT and valid ...


28

That link you posted looks like a very ugly hack type solution. However, according to the man page, gdisk, which is used to convert MBR -> GPT, also has an option in the "recovery & transformation" menu (press r to get that) to convert GPT -> MBR; the g key will: Convert GPT into MBR and exit. This option converts as many partitions as ...


17

As the OS was not specified, here is FreeBSD way of doing things. All is done through the gpart command (short for GEOM partioner - nothing to do with GNU). A simple gpart show would show you all the available partitions of all the disks, but you can specify the device to have a more precise look on one: legacy partition layout with MBR (aka "msdos") and ...


16

Most of the previous respondents are correct when they say that you can usually do what you need with a GPT partition table layout, but since there are valid reasons for wanting to use MBR, I think I will just answer your question instead of assuming you are wrong for asking. To get rid of the GPT, you need to remember that with this format, there is a ...


15

The old 32KiB gap between MBR and first sector of file system is called DOS compatibility region or MBR gap, because DOS required that the partitions started at cylinder boundaries (and each cylinder had 64 sectors i.e. 64 sectors * 512 bytes/sector= 32KiB space). Legacy GRUB (GRUB1) could've used it to install GRUB1 1.5-stage bootloader there: http://www....


13

Assuming that there is 512-byte DOS-like MBR, and you have replaced first 446 bytes of it with some crap (zeros or just /dev/urandom output), or damaged the bootcode some other way. In this case MBR partition table is on it's place, but system cannot boot from this device. Idea is to use other BSD-like system's loader to boot with your device and your ...


12

TO ADDRESS YOUR EDIT: I didn't notice the edit to your question until just now. As written now, the question is altogether different than when I first answered it. The mirror you describe is not in the spec, actually, as it is instead a rather dangerous and ugly hack known as a hybrid-MBR partition format. This question makes a lot more sense now - it's not ...


10

If you don't want to fiddle with dd, gdisk can do: $ sudo gdisk /dev/sdb GPT fdisk (gdisk) version 0.8.8 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. Command (? for help): ? b back up GPT data to a file <snip> w write table to disk and exit x extra ...


10

MBR, Master Boot Record Wikipedia excerpt; link: A master boot record (MBR) is a special type of boot sector at the very beginning of partitioned computer mass storage devices like fixed disks or removable drives intended for use with IBM PC-compatible systems and beyond. The concept of MBRs was publicly introduced in 1983 with PC DOS 2.0. I ...


9

With udisks on Linux: $ sudo /lib/udev/udisks-part-id /dev/sda using device_file=/dev/sda syspath=/sys/devices/pci0000:00/0000:00:0b.0/ata1/host0/target0:0:0/0:0:0:0/block/sda, offset=0 ao=0 and number=0 for /dev/sda Entering MS-DOS parser (offset=0, size=500107862016) MSDOS_MAGIC found found partition type 0xee => protective MBR for GPT Exiting MS-DOS ...


7

From what I just found out, it may be unsafe. I was getting this same error *************************************************************** Found invalid GPT and valid MBR; converting MBR to GPT format in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by typing 'q' if you don't want to convert your MBR partitions to GPT format! ...


6

This is a performance optimization and not related to Linux at all, just to the hardware. Modern disks (so called "4K" disks) use physical sectors of 4096 byte instead of 512. You still can address single 512-byte sectors but that may severely impact performance if the partitions (or rather: file systems) are not aligned to 4K. Start sector 64 would be ...


6

Use gdisk /dev/sda Note: /dev/sda is in the case of the person who asked this question but change it to your drive name. Once you are inside with gdisk use: x extra functionality (experts only) then when you type p to see all the options, you will see this: Expert command (? for help): ? a set attributes c change partition GUID d display the ...


6

Actually GRUB2 is not normally installed to a VBR. It recommends against this practice. It's something like there not being enough space there to bundle a filesystem module for /boot. Historically, MBR disks give you 62 "reserved" sectors for such boot code. (Because the first partition starts on a cylinder boundary. Nowadays we ignore cylinders, but it'...


6

It is usually not installed there. Most of the time, GRUB (stage 1) is installed in the MBR only, on Linux. Although GRUB version 1 will always overflow a little in the 30 kB following the MBR (stage 1.5, i.e. filesystem drivers), with GRUB version 2, the code installed within the MBR can load some other and bigger code (stage 1.5) by raw reading any ...


6

The space available in the MBR itself is tiny. (About 400 bytes or something.) That's way too small to fit an entire filesystem driver. Without a filesystem driver, there's no way to figure out where on disk the kernel is stored, and hence you can't load the kernel. You could try hard-coding the location of the kernel into the MBR itself. But then if the ...


6

Use $ sudo fdisk -l Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x987c1a05 Device Boot Start End Sectors Size Id Type /dev/sda1 * ...


6

The MBR IS 512 bytes. So the first example is how you would back it up. The partition table is at the end, in the area after 440 bytes in - so, if you wanted to back it up WITHOUT the partition table, then you could use the second example (why you'd want that, I don't know).


6

The MBR (Master Boot Record) is 512 bytes. 446 bytes Bootloader 64 bytes (4 * 16 bytes) Partition Tables 2 bytes Magic Number which is AA55H However these values are for generic MBR, you can see other MBR structures from: https://en.wikipedia.org/wiki/Master_boot_record Anyway you have to backup hole 512 bytes of MBR with dd (disk-to-disk) command.


5

I created an MBR disk with one partition, filled every single byte on that partition with data, created a SHA1 checksum of the whole partition, converted it to GPT as described in the question, created yet another checksum and compared it with the original. They were the same. So my conclusion is this: You can safely convert a disk to GPT without corrupting ...


5

You can save your MBR to a file using dd dd if=/dev/sdX of=~/MBR.backup bs=512 count=1 Where X is the device you want the backup from. Mind the if parameter it is the device (sda) not the partition (sda1,sda2,sdb1, etc...)


4

It turns out that using rsync or dump to copy the /boot partition was causing the problem. Based on erick's answer above, I booted a live CD into rescue mode and ran the following dd commands. dd if=/dev/sda of=mbrbackup bs=512 count=1 dd if=mbrbackup of=/dev/sdb bs=446 count=1 dd if=/dev/sda1 of=/dev/sdb1 I ran the first two dd's again just to make sure ...


4

I successfully achieved converting MBR to GPT, but used two extra (new) disks for safety reasons. Note that I'm using Debian in combination with the GRUB bootloader. With my setup, which simply has a Linux partition and a swap partition, the procedure is roughly as following. First, make a full backup: use the first extra disk to make a full backup of the ...


4

Quoting the Ubuntu UEFI Community Wiki. The same Rules apply regardless of Distribution. Creating an EFI partition If you are manually partitioning your disk in the Ubuntu installer, you need to make sure you have an EFI partition set up. If your disk already contains an EFI partition (eg if your computer had Windows8 preinstalled), it can be used for ...


4

The MBR partition format is three decades old, and subject to weirdness for historical reasons. Back then, the computer needed to know the geometry of the hard disk. How is data organized on a hard disk? In three dimensions: cylinder, heads and sectors. (Diagram by LionKimbro) The geometry was stored with maximum values that were large enough for the time:...


4

128 partitions is the default limit for GPT, and it's probably painful in practice to use half that many... Linux itself originally also had some limitations in its device namespace. For /dev/sdX it assumes no more than 15 partitions (sda is 8,0, sdb is 8,16, etc.). If there are more partitions, they will be represented using 259,X aka Block Extended Major. ...


3

Sorry, but you had a Sony VIAO laptop set up as dual boot. Here's why: dd didn't overwrite just the MBR (i.e. the first 512B sector) - that would be quite annoying, but still fixable. It also took good part of at least the first partition on your hard drive. Unless you had a very interesting setup with system partitions not at the beginning of the dish, it ...


3

If the two hard-disks are of the same size (or the new one is bigger), why didn’t you just copy the old disk to the new disk? I.e. dd if=/dev/sda of=/dev/sdb Now, if the new hard-disk is bigger, change the partition sizes with parted or gparted. All this done booting from a live CD/USB-stick.


3

Rather than dd, I built a new volume. More steps, but might fix problems rather than copy them over. I had a too small /boot that got corrupted. I also was using cento7 with grub2. So my instructions would require some adjustments or upgrade to grub2 as psusi suggested. I tried to note the changes. NOTE: When I use "/dev/sdx", I am assuming that your ...


Only top voted, non community-wiki answers of a minimum length are eligible