Reformatting external harddrive

Matthew Seaman m.seaman at infracaninophile.co.uk
Tue May 12 16:01:58 UTC 2009


Daniel Underwood wrote:
> After unsuccessfully trying to reformat my external harddrive on my
> linux machine, I'm trying to reformat the disk in FreeBSD.  Frankly, I
> just don't know how to do that. Please help me get the disk back to
> working order; I don't need to keep any data that is currently on the
> disk.
> 
> The command
> 
> $ /dev/da0

ITYM: fdisk /dev/da0

> gives the following output:
> 
> ******* Working on device /dev/da0 *******
> parameters extracted from in-core disklabel are:
> cylinders=38913 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=38913 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 625137282 (305242 Meg), flag 80 (active)
> 	beg: cyl 0/ head 1/ sector 1;
> 	end: cyl 0/ 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>

This says that you have written a partition table onto the drive that
indicates the whole disk is being used for FreeBSD.  That's a good
start if your intention is to use the disk dedicated for FreeBSD.

The way the partition naming scheme works you should now have a /dev/da0s1
device file (indicating 'slice 1' or disk 'da0')

In order to make the disk usable with FreeBSD, you need to follow something
like these steps:

   * Use bsdlabel(8) to create BSD partitions on slice1.  To write a 
     default label:

         # bsdlabel -w /dev/da0s1

     Then to edit the default label and define the partitions you want,

         # bsdlabel -e da0s1

     Edit mode will pop up an editor with the existing BSD partition
     table -- that's vi(1) by default but you can override it by setting the
     EDITOR environment variable.

     If your aim is to use this disk as one big filesystem for storing data
     then creating a 'd' partition covering all the available space would be
     appropriate.  After saving the edited partition table you should now have
     a device file:

         /dev/da0s1d

   * Use newfs(8) to create a filesystem on the drive.  I'd just leave it with
     the default settings unless you know you're going to be using the disk 
     for unusually large files or unusually many very small files.

         newfs /dev/da0s1d

   * Mount the new filesystem to make it available to FreeBSD.  Add a line like
     the following to /etc/fstab:

         /dev/da0s1d    /data    ufs    rw    2    2

      Then create the mount point:

        # mkdir -p /data

      and mount the drive:

        # mount /data

      The drive will be remounted automatically on system reboots and is expected
      to be permanently present.  If you want to have the disk be removable, then
      read all about amd(8) and feel free to ask again here.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20090512/ca81de96/signature.pgp


More information about the freebsd-questions mailing list