how to format an external usb drive with a freebsd partititon under freebsd 5.3

Giorgos Keramidas keramida at FreeBSD.org
Mon May 16 03:59:03 PDT 2005


On 2005-05-16 00:55, Steve <steve at digitalbluesky.net> wrote:
> I've done a google search, read the freebsd handbook and searched the
> mailing list archives...maybe I'm not using the right search terms but
> I'm not finding the information I need...or I'm misunderstanding
> something on a fundamental level.
>
> I have a 120 gig western digital usb drive with a FAT32 file system
> connected to a freebsd 5.3 box that I can mount and read/write to okay
> .  But (and I think this is correct) when I backup files from my
> freebsd 5.3 box to this drive, the file permissions aren't being
> maintained.  That is because it's a FAT32 files system correct?  I've
> always in the past backed up linux/freebsd files to other
> linux/freebsd boxes so this is the first time I'm dealing with this.
>
> What is the correct way to format this FAT32 usb drive so I can put
> freebsd files on it and maintain the proper owner and file
> permissions.  I've tried to do this with sysinstall based on the
> instructions in the freebsd handbook but I get an error that freebsd
> can't write the partition.
>
> The usb drive is currently mounted, is that the problem?

YES, that is a serious problem.  You cannot run "newfs" on a mounted
partition in FreeBSD.  It would mess up the internal state the kernel
keeps around for mounted devices (disk & device information, pending I/O
buffers, etc).

The correct way to switch a disk/partition to UFS is:

	1. Mount any partitions the disk has now.

	2. Backup the data of the disk somewhere.

	3. Unmount ALL the partitions of the disk.

	4. Create a BIOS partition (these are called "slices" by
	   FreeBSD) on the disk that covers the area you want to format.

	5. Label the slice, creating a BSD partition in it.

	6. Run newfs on the new BSD partition.

	7. Mount the partition.

	8. Restore the data you backed up in step 2.

The command line tools that you can use to create & format new BSD
partitions are described in the article ``Formatting Media For Use With
FreeBSD'', which is available as part of the FreeBSD documentation set:

http://www.freebsd.org/doc/en_US.ISO8859-1/articles/formatting-media/

If you read that article and find that it lacks some details or that it
confuses you in any way, then it's a bug of the documentation.  In that
case, feel free to mail me in person or to contact the FreeBSD
documentation team (by mailing the freebsd-doc at freebsd.org list).

- Giorgos



More information about the freebsd-questions mailing list