FreeBSD: Creating partitions and file systems

Prepare the drive

by ross at 08:11:29 on November 18, 2012

Deleting MBR slices/partitions

# gpart show ada1
=>       63  976773105  ada1  MBR  (465G)
         63  976773105     1  freebsd  [active]  (465G)

# gpart show ada1s1
=>        0  976773105  ada1s1  BSD  (465G)
          0  976773105       4  freebsd-ufs  (465G)

One MBR slice of type freebsd with one partition inside which holds UFS filesystem.

# gpart delete -i 4 adas1
ada1s1d deleted

Repeat for every partition in the slice. When the slice is empty:

# gpart destroy ada1s1
ada1s1 destroyed
# gpart delete -i 1 ada1
ada1s1 deleted

The following will delete MBR partition table. Do this if you want to switch to GPT partition scheme.

# gpart destroy ada1
ada1 destroyed
# dd if=/dev/zero of=/dev/ada1 count=1024

Deleting GPT partitions

# gpart show ada1
=>       34  976773101  ada1  GPT  (465G)
         34  976773101     1  freebsd-ufs  (465G)

One GPT partition covering entire drive.

# gpart delete -i 1 ada1
ada1p1 deleted

Repeat for other GPT partitions you have. If you want to switch to MBR delete the table:

# gpart destroy ada1
ada1 destroyed
# dd if=/dev/zero of=/dev/ada1 count=1024

 

Comments