System Administration Guide: Devices and File Systems

ProcedureHow to Create a File System on a USB Mass Storage Device

A USB diskette must be formatted before you can add a file system to it. All other USB mass storage devices just need a PCFS or UFS file system before they can be used. Keep the following key points in mind when formatting a USB device:


Note –

Perform steps 4-5 only if you need to format a USB diskette.


  1. Become superuser.

  2. Add the USB device to your system. For information on hot-plugging USB devices, see:

  3. (Optional) Identify the USB device.

    For example:


    # cd /dev/rdsk
    # ls -l c*0 | grep usb
    lrwxrwxrwx   1 root  root   55 Mar  5 10:35 c2t0d0s0 ->
    ../../devices/pci@1f,0/usb@c,3/storage@3/disk@0,0:a,raw

    In this example, the diskette device is c2t0d0s0.

  4. Insert a diskette into the diskette drive, if necessary.

  5. Format the diskette, if necessary.


    % rmformat -F long raw-device
    

    For example, on a SPARC system:


    % rmformat -F long /dev/rdsk/c2t0d0s2
    

    For example, on an x86 system:


    % rmformat -F long /dev/rdsk/c3t0d0p0
    
  6. Determine the file system type and make sure the device is unmounted. Then, select one of the following:

    For more information about unmounting a USB device, see How to Mount or Unmount a USB Mass Storage Device Without vold Running.

    • Create a PCFS file system.


      # mkfs -F pcfs -o nofdisk,size=size raw-device
      

      Specify the -size option in 512-byte blocks.

      The following example shows how to create a PCFS file system on a 1.4-MB diskette on a SPARC system:


      # mkfs -F pcfs /dev/rdsk/c2t0d0p0
      Construct a new FAT file system on /dev/rdsk/c2t0d0p0: (y/n)? y
      

      The following example shows how to create a PCFS file system on a 1.4-MB diskette on an x86 system:


      # mkfs -F pcfs /dev/rdsk/c2t0d0s2
      Construct a new FAT file system on /dev/rdsk/c2t0d0s2: (y/n)? y
      

      The following example shows how to create a PCFS file system on a 100-MB USB memory stick on a SPARC system:


      # mkfs -F pcfs /dev/rdsk/c5t0d0s2:c
      

      The following example shows how to create a PCFS file system on a 100-MB USB memory stick on an x86 system:


      # mkfs -F pcfs /dev/rdsk/c5t0d0p0:c
      

      This command can take several minutes to complete.

    • Create a UFS file system.


      # newfs raw-device
      

      For example:


      # newfs /dev/rdsk/c4t0d0s7
      

      Consider using the newfs -f 4096 option or newfs -T option for large USB hard disks.


      Note –

      UFS file system overhead consumes a significant portion of space on a diskette, due to a diskette's limited storage capacity.


    See the next two procedures for a detailed example of creating a PCFS file system and modifying slices on a USB mass storage device.