Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to format a partition under FreeBSD and change it to UFS filesystem. I searched the web but even the "fdisk" man page is not clear at all. Any help would be clearly appreciated !

My current partition is :

fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=121601 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=121601 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 1953520002 (953867 Meg), flag 80 (active)
    beg: cyl 0/ head 1/ sector 1;
    end: cyl 768/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
share|improve this question
    
haven't used *BSD, but in linux land the mkfs collection of programs are used to create filesystems –  Hubert Kario Nov 6 '10 at 16:11
    
yes I'm a Linux expert but it seems that FreeBSD is completely different when dealing with disks. –  db_ch Nov 6 '10 at 17:04
add comment

migrated from stackoverflow.com Nov 6 '10 at 14:40

This question came from our site for professional and enthusiast programmers.

4 Answers

The FreeBSD handbook is an invaluable resource and has a section that details how to add disks to an existing system: Adding Disks.

share|improve this answer
add comment

fdisk for partitions
bsdlabel for slices (for the uninitiated, like partitions for partitions)
newfs for UFS (the native file system)

Quick 1 partition, 1 slice disk:

fdisk -BI [drive]
bsdlabel -wB [drive]s1
newfs [drive]s1a

After which you could mount it with something similar to:

mount [drive]s1a /mnt
share|improve this answer
add comment
up vote 1 down vote accepted

My question was answered on : http://forums.freebsd.org/showthread.php?p=108748

Hope it will help someone else :-)

Best regards

share|improve this answer
add comment

Nowadays you should use gpart to partition the disk (fdisk/disklabel are being overtaken by gpart since it supports GPT), newfs to format UFS[2] partitions and zpool to create ZFS filesystems. For example to initialize a new, unused disk with a UFS filesystem:

GPT:
gpart create -s gpt adaX
gpart add -t freebsd-ufs adaX
newfs /dev/adaXp1

MBR:
gpart create -s mbr adaX
gpart add -t freebsd adaX
gpart create -s bsd adaXs1
gpart add -t freebsd-ufs adaXs1
newfs /dev/adaX1s1a

If the disk is already partitioned and you want to repartition it, see what's already present with:

gpart show adaX

You can then delete partitions using "gpart delete -i y adaX:

gpart delete -i 4 adaX

You can use "gpart destroy" to destroy the scheme if you want to change it from MBR to GPT for example:

gpart destroy adaX
gpart create -s gpt adaX

GPT is generally preferred nowadays unless you have to interoperate with systems which don't understand it since it can break the 2TB limit and have up to 2^32-1 partitions (in theory!).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.