# Confused about slices, paritions and disklabels



## bluedalmatian (Jan 12, 2014)

Im I'm confused about slices, partitions and disklabels on FreeBSD. As I understand it, on x86 systems, each disk can have four slices (referred to as partitions in Windows/Linux) and each slice has a disklabel which defines the partitions within that slice. Ive I've installed FreeBSD 9.1 on a 1 TB hard disk using the default options of using the entire disk.

Running `fdisk /dev/ada0` shows:

```
The data for partition 1 is:
sysid 238 (0xee),(EFI GPT)
    start 1, size 1953525167 (953869 Meg), flag 80 (active)
        beg: cyl 0/ head 0/ sector 2;
        end: cyl 1023/ head 255/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
```

As I understand this, everything is in slice 1? But I cannot see the disklabel for the slice. Running `disklabel /dev/ada0s1` gives:


```
disklabel: unable to get correct path for /dev/ada0s1: No such file or directory
```

This is the fstab file:


```
# Device        Mountpoint      FStype  Options Dump    Pass#
/dev/ada0p2     /               ufs     rw      1       1
/dev/ada0p3     none            swap    sw      0       0
```

which seems to show the partitions directly on the disk, with no slices and doesnt doesn't tally with the output from `fdisk`. I tried to run `disklabel /dev/ada0` but that gives:


```
disklabel: /dev/ada0: no valid label found
```

If I go into fdisk via `sysinstall` I get this, which is totally different from running `fdisk` from the command line:


```
Disk name:      ada0                                   FDISK Partition Editor
DISK Geometry:  1938021 cyls/16 heads/63 sectors = 1953525168 sectors (953869MB)

Offset       Size(ST)        End     Name  PType       Desc  Subtype    Flags

         0         40            39        -     12             unused        0
        40        128        167   ada0p1      5    unknown        0
       168 1944059768 1944059935   ada0p2      5    unknown        0
1944059936    8388608 1952448543   ada0p3      5    unknown        0
1952448544    1076624 1953525167        -     12     unused        0
```

Can anyone please explain whats what's going on here as nothing adds up.


----------



## wblock@ (Jan 12, 2014)

*Re: Confused about slices, paritions & disklabels*

sysid 238 (0xee),(EFI GPT) means this disk uses GPT partitions.  GPT is a newer format that gets rid of most of the ridiculous complications of the old MBR format.  For example, it is not limited to only four "slices", but can have up to 128 in the standard configuration.

Because most systems can't boot directly from GPT, a "protective MBR" is written to the disk.  This enables booting from older machines, but shows as a single large partition rather than the actual GPT partitions.

From now on, please stop using the old fdisk(8) and bsdlabel(8) tools.  They have been superseded by gpart(8), which does everything they do, only generally easier and better.  It also supports both GPT and MBR formats, in addition to others.  Also, stop using [cmd=8]sysinstall[/cmd], it is obsolete, does not understand GPT, and has some bugs that can do bad things for bootable disks.

To see what is really on that disk, use `gpart show ada0`.


----------



## bluedalmatian (Jan 13, 2014)

*Re: Confused about slices, paritions & disklabels*

Thanks for that, that makes more sense now*.*


----------

