Hot answers tagged

103

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 ...


79

In order to align partition with parted you can use --align option. Valid alignment types are: none - Use the minimum alignment allowed by the disk type. cylinder - Align partitions to cylinders. minimal - Use minimum alignment as given by the disk topology information. This and the opt value will use layout information provided by the disk to align the ...


34

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 ...


30

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 ...


24

After a day of research, I can now answer my own Question: yes it is possible, and you can even use that partition as /boot and store your kernels/initramfs/etc. there. Requirements: Grub >= 2.00 (1.98 and 1.99 do not work) Grub must be installed from a Linux kernel, that has support for EFI variables (CONFIG_EFI_VARS compiled in or as module efivars) For ...


23

Will dd if=/dev/zero of=/dev/sda wipe out a pre-existing partition table? Yes, the partition table is in the first part of the drive, so writing over it will destroy it. That dd will write over the whole drive if you let it run (so it will take quite some time). Something like dd bs=512 count=50 if=/dev/zero of=/dev/sda would be enough to overwrite the ...


18

I'm going use the term BIOS below when referring to concepts that are the same for both newer UEFI systems and traditional BIOS systems, since while this is a UEFI oriented question, talking about the "BIOS" jibes better with, e.g., GRUB documentation, and "BIOS/UEFI" is too clunky. GRUB (actually, GRUB 2 -- this is often used ambiguously) is the bootloader ...


17

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 ...


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 ...


15

UUID is a filesystem-level UUID, which is retrieved from the filesystem metadata inside the partition. It can only be read if the filesystem type is known and readable. PARTUUID is a partition-table-level UUID for the partition, a standard feature for all partitions on GPT-partitioned disks. Since it is retrieved from the partition table, it is accessible ...


14

mdraid always allows you to move disks around freely in the machine, regardless of how you add the disk to the array. It tracks the disks by the RAID metadata (superblocks) stored on the disk. Note that this assumes mdadm can find the disks when its assembling the arrays. The default (specified in /etc/mdadm/mdadm.conf) is normally DEVICE partitions, which ...


12

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 ...


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 ...


11

From the Arch Wiki: When creating a partition, parted might warn about improper partition alignment but does not hint about proper alignment. For example: (parted) mkpart primary fat16 0 32M Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? The warning means ...


10

The extended and logical partitions make sense only with msdos partition table. It's only purpose is to allow you to have more than 4 partitions. With GPT, there are only 'primary' partitions and their number is usually limited to 128 (however, in theory there is no upper limit implied by the disklabel format). Note that on GPT none of the partitions could ...


10

The partition unique GUID is generated at the time that the partition is created. It uniquely identifies the partition at least inside the disk and probably among all the disks you own (because it's unbelievably rare for GUIDs to collide). A partition GUID code (by which I believe you mean a partition type GUID), on the other hand, is a known, fixed GUID. ...


10

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! ...


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 ...


10

The partition table is stored near the beginning1 of the (logical2) disk device. Overwriting that area with anything (zeroes from /dev/zero or any other data) will replace the partition table with gibberish, so it will no longer be obvious where the partitions on the device begin. One can still scan the whole disk and try to identify the "magic bytes" that ...


9

My solution has been to use gdisk which can perform partitions alignment automatically on a 2048 sectors (1024KiB) by default, although it can be changed in the expert menu.


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 ...


9

gdisk only has the one command line option (-l), to list the partition table and then quit. All of the other operations are conducted interactively from within gdisk. See Rod Smith's walkthrough for some more context. Essentially, though, you want to just use the command # gdisk /dev/sdb and then, at the prompt, use the s command to sort the partition ...


9

EFI knows how to access FAT and FAT32 filesystems. This is why your EFI boot partition has to be FAT or FAT32 formatted. EFI however does not know how to read a software RAID 1 partition, even if it is formatted using FAT32. There is a pretty simple away around this, at least using Arch Linux. When installing the system, you set the boot partition up as ...


9

grub itself does not care about boot flags. An EFI System partition is distinguished by its GUID type C12A7328-F81F-11D2-BA4B-00A0C93EC93B, not by a boot flag. Yes, this partition needs to be formatted FAT32. Not all FAT32 partitions are EFI System partitions, only one of them, and that one, if present, is small and has a special purpose. On a computer which ...


8

The accepted answer by @lik shows how you can specify the preferred alignment. However, parted always uses that alignment for checking the resulting partition, but not always creates partitions with that alignment. TL;DR: When 1MiB is the optimal alignment, specifying 0% will work for disks of 200MiB and bigger. For smaller disks or larger alignment, ...


8

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 ...


8

A minor correction. As I understand it, GPT disks don't have partition types anymore, they are all "primary". Command 'mkpart primary' doesn't create a primary partition like it does on msdos disks, it just creates a partition called primary. You can just as well use command (parted) mkpart Parted-FUN! 21476MB 4000787MB (parted) print Model: ATA ST4000DM000-...


8

Partitioners like to align partitions on a mebibyte boundary these days. For MBR partitioning, there are 4 primary partitions, and for the rest you need extended and logical partitions. While the layout of the primary partitions is expressed at the end of the first sector of the disk, for the logical partitions, you've got a linked list of additional ...


8

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 * ...


8

You cannot use fdisk to work with GPT disks, it will only work with MBR disks. Any disk that > 2TB must be GPT. You likely cannot mount this HDD because even though the kernel has detected it (in the dmesg output) the HDD hasn't been partitioned or formatted with a filesystem so that it can be mounted. Try the following to do this: $ sudo sfdisk -l This ...


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