4

What kind of partition table does Linux create by default? Is it msdos? Is it different depending on the Linux distribution used(I'm using Ubuntu)? Is there any command line utility I could use to find out that information?

4 Answers 4

3

There is no default partition format for Linux. It can handle many of popular and less popular formats.

The type is determined by the tool you are using. fdisk can handle standard MS-DOS partition tables while parted can handle GUID partition tables as well. You can create other tools for any format you like.

Most distributions will create MS-DOS partitions on standard PC and possibly use GUID tables on EFI systems (like Macs) for simple reason - Windows cannot boot from GUID partition table with BIOS (which is on standard PC) - only EFI.

As for second part - fdisk -l presented will print standard partitions (thosed used on MS DOS). parted -l will show all "partitions" - including for example LVM logical volumes.

EDIT: If you want to dump the partition table (binary) use dd if=/dev/your_disk count=1.

2
  • 3
    If you use that dd command, be very careful not to type of= instead of if=. if= means input file, while of= means output file, i.e. overwrite your disk. Aug 30, 2010 at 20:54
  • 1
    @Gilles - Not unless you type something. Jan 31, 2011 at 13:02
2

If you install Linux on a PC, the installation program will create one or more partitions in a format that is compatible with DOS, OS/2 and Windows, because that's the de facto standard for partitions on a PC.

If you install Linux on some other kind of hardware, the installation program may use a different partitioning scheme. Linux supports a lot of different schemes (you can see them all in the kernel configuration — search CONFIG_.*_PARTITION in /boot/config-*).

Even on a PC, you might see other partition types for a variety of reasons: because you went out of your way to create them, because you inserted a disk from some other architecture, because you have another operating system that uses different partition types (e.g. *BSD, Solaris).

1

open up a terminal and list your drives first:

sudo fdisk -l

output similar to this:

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2bd2c32a

Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        6375    51200000    7  HPFS/NTFS
/dev/sda2   *        6375        6400      204800   83  Linux
/dev/sda3            6400       19457   104883521   8e  Linux LVM

Disk /dev/dm-0: 103.2 GB, 103238598656 bytes
255 heads, 63 sectors/track, 12551 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 4160 MB, 4160749568 bytes
255 heads, 63 sectors/track, 505 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/sdb: 2003 MB, 2003828736 bytes
255 heads, 63 sectors/track, 243 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         243     1951866    c  W95 FAT32 (LBA)

From this you can see Disk /dev/sdb, and /dev/sda as disks.

To view partition table of one do:

sudo fdisk /dev/sda 

Then see the following: 


The number of cylinders for this disk is set to 19457.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): 

Press "p" to list partitions or m for help. From here you can modify partition tables, and when you are all finished press "w" to write changes to disc. Next if you create a new partition, lets say ext3 you will need to use something like mkfs or a GUI based tool to create a ext3 partition there.

0

Unlike Microsoft Windows drive letters (C:,D: etc.), partitions on Linux show up as device files (/dev/sda1, /dev/sda2, /dev/sdb1 etc.). You can create the root directory on any one of the partition (as long as the partition is large enough) or spread it across several partitions (recommended).

In modern Linux distributions the filesystems you will find most often are ext2 and ext3; but they will also support read/write from NTFS and FAT32. Run fdisk -l as root to see how your disk has been partitioned.

1
  • I don't want to see how my hdd has been partitioned. I want to see the partition table "itself".
    – celavek
    Aug 30, 2010 at 12:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .