Difference of opinion about my disk geometry

Bruce Cran bruce at cran.org.uk
Fri Aug 27 18:53:12 UTC 2010


On Fri, 27 Aug 2010 09:58:42 -0700
Doug Barton <dougb at FreeBSD.org> wrote:

> What I definitely think is true at this point is that my 25-year-old 
> "knowledge" about this stuff is now worse than useless. :)  So I need
> to learn how to to do it better. I took a look at the man page for
> gpart and it's way over my head. I was not impressed with the way
> that the disk slicer for the ubuntu installer worked. Biggest single
> objection was that it considers 1 gigabyte to be 1,000,000 bytes, but
> at least it said this somewhere obvious so I could do the math to
> make it "right" myself, and fwiw Nautilus and the gnome "Disk
> Utility" seem to have the same view of the world, even though 'df -h'
> shows the "real" Gbs. However the results seemed Ok. I did some
> digging on line and saw many references to gparted, which is included
> in the ubuntu live cd, and seemed quite easy to work with.

Apparently it's Ubuntu's policy to use base 10 units for disks:
https://wiki.ubuntu.com/UnitsPolicy

gpart isn't very easy to learn, but quite straightforward to use once
you understand it - but one problem is that the manpage leaves a lot
of usability details out such as the ability to specify sizes in MB/GB
and to omit sizes in order to use the rest of the space. It also
doesn't mention initializing the freebsd container with a "bsd" (or
MBR) scheme.

For example, to setup a disk with 40GB for FreeBSD, 50GB for Windows and
the rest for Linux:

Create an mfs system to work on:
truncate -s 100G mdfs
mdconfig -a -f mdfs

Init the disk with an MBR: gpart create -s mbr md0
Create a BSD container:    gpart add -t freebsd -s 40G md0
Init with a BSD scheme:    gpart create -s bsd md0s1
Use 1GB for /:             gpart add -t freebsd-ufs  -s 1G md0s1
4GB for swap:              gpart add -t freebsd-swap -s 4G md0s1
2GB for /var:              gpart add -t freebsd-ufs  -s 2G md0s1
1GB for /tmp:              gpart add -t freebsd-ufs  -s 1G md0s1
The rest for /usr:         gpart add -t freebsd-ufs md0s1

Back in the MBR, create an NTFS partition: gpart add -t ntfs md0
We also want Linux, so del and re-create:  gpart delete -i 2 md0
This time, only use 50GB for NTFS:         gpart add -t ntfs -s 50G md0

At this point it's not possible to create Linux partitions, because the
"linux-data" and "linux-swap" types are only available if you're
working on a GPT disk.

At each stage you can also specify "-f x" e.g. "gpart create -f x -s
mbr md0" in order to have the new layout stored in memory but not
written to disk until you run "gpart commit md0".

It seems the issue about cylinder alignment came about through
compatibility issues with old versions of Windows (98/ME) and
appartently (http://tldp.org/HOWTO/Large-Disk-HOWTO-6.html) sparc needs
the boot partition to start on a cylinder boundary.  It also seems that
diskpart in Windows has some rules regarding cylinder alignment too
(http://support.microsoft.com/kb/300415).

-- 
Bruce Cran


More information about the freebsd-fs mailing list