Search This Blog

2013-04-15

FreeBSD Disk Slices and Partitions

Create MBR Partitioning Scheme
gpart create -s mbr ad0

Install boot code to the mbr - basically setting the boot flag for the disk
Note: that the /boot/mbr directory must exist on your existing OS (I'm using FreeBSD 6 diskless)
gpart bootcode -b /boot/mbr ad0

Create Partitions

MBR/Root Partition - slice
gpart add -s 800M -t FreeBSD ad0

Set it to active so FreeBSD will know to boot off of this specific partition
gpart set -a active -I 1 ad0

BSDLabel Partitioning - sub-mbr partitions - / - root
gpart create -s bsd ad0s1
Add boot code to the sub partitions as it needs to have a boot flag as well to know it can boot off this drive
gpart bootcode -b /boot/boot ad0s1

Add partitions to the MBR/root
gpart add -t FreeBSD-ufs ad0s1

Create the FS structure on root with the UFS label of ROOT
newfs -L ROOT -U /dev/ad0s1a

Mount the root partition
mkdir -p /mnt/root
mount /dev/ad0s1a /mnt/root

Now you can un-tar a filesystem to /mnt/root!
cd /mnt/root
fetch ftp://path/to/file.tar
tar -xf file.tar
rm file.tar

BSDLabel, Slices and MBR (Dangerously Dedicated)

The only reason that I have seen to create slices is if you wish to maintain compatibility with MBR based OSes (such as windows). FreeBSD will commonly encapsulate bsdlabel inside an mbr slice.

If you're running on FreeBSD only machine you do not even have to use MBR slices and can use bsdlabel directly which would result in partition names such as ad0a, ad0b, da0a instead of ad0s1a, ad0s1b, da0s1a.

The mode in which you do not maintain compatibility with MBR is called "dangerously dedicated" mode but it is perfectly acceptable as long as you do not need to maintain MBR compatibility for anything.

I've also recently heard that in FreeBSD8 and 9 they have removed the ability to configure devices in "dangerously dedicated" mode.

http://www.wonkity.com/~wblock/docs/html/disksetup.html
http://forums.freebsd.org/showthread.php?t=25820

No comments:

Post a Comment