Page 1 of 1

Format Mass-Storage device for cross-platform capabilites Using fdisk and mkfs under OpenSolaris Rate Topic: -----

#1 -shadow-  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 17
  • View blog
  • Posts: 204
  • Joined: 18-November 10

Posted 23 November 2010 - 08:17 PM

Format Mass-Storage device for cross-platform capabilites
Using fdisk and mkfs under OpenSolaris

To set up a storage device such as an external hard-disk or
a USB flash drive, you must first open a terminal and log in
as root. Connect your device and use the rmformat command to
find the logical node so you can later tell fdisk where to
find it.
# rmformat -l
Looking for devices...
     1. Logical Node: /dev/rdsk/c5t0d0p0
        Physical Node: /pci@0,0/pci-ide@1f,2/ide@1/sd@0,0
        Connected Device: TSSTcorp CD/DVDW TS-L632D TI03
        Device Type: CD Reader
	Bus: IDE
	Size: <Unknown>
	Label: <Unknown>
	Access permissions: <Unknown>
     2. Logical Node: /dev/rdsk/c6t0d0p0
        Physical Node: /pci@0,0/pci8086,1999@1d,7/storage@4/disk@0,0
        Connected Device:          USB Flash Memory PMAP
        Device Type: Removable
	Bus: USB
	Size: 1.9 GB
	Label: <Unknown>
	Access permissions: Medium is not write protected.


As you can see, number 2 is a USB flash drive. Our logical node
is c6t0d0p0.

We will now give fdisk this logical node so it can find the drive
we want to format.

# fdisk c6t0d0p0


After performing this command, you will get a menu like this:
             Total disk size is 957 cylinders
             Cylinder size is 4096 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1       Active    DOS-BIG           0   957     958    100




SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Edit/View extended partitions
   6. Exit (update disk configuration and exit)
   7. Cancel (exit without updating disk configuration)
Enter Selection: 3


My drive is currently formatted as DOS-BIG.
We will use option 3 to remove this partition and erase
all the contents of the drive. WARNING THIS CANNOT BE
UNDONE!

So enter option 3 if your device has a track laid. When
fdisk asks you to specify the partition number, enter 1.
If there are multiple partitions, delete all of those.
Simply skip this step if you want to use the preset fdisk
track. In my case, I will be erasing the drive.

You should get something like this:
             Total disk size is 957 cylinders
             Cylinder size is 4096 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===




WARNING: no partitions are defined!
SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Edit/View extended partitions
   6. Exit (update disk configuration and exit)
   7. Cancel (exit without updating disk configuration)
Enter Selection: 


Partition 1 has been deleted. This was the active partition.


Now we want to define a partition.
To make your device readable on a cross-platform basis, you will
have to choose a format that both systems are able to read.

If we use an example of Windows to Unix:
Windows recognizes fstypes: PCFS and NTFS. Unix does not recognize
NTFS by default so FAT32 will be the best format in this case.
Now press 1 to create a partition:

             Total disk size is 957 cylinders
             Cylinder size is 4096 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===





SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Edit/View extended partitions
   6. Exit (update disk configuration and exit)
   7. Cancel (exit without updating disk configuration)
Select the partition type to create:
   1=SOLARIS2  2=UNIX        3=PCIXOS     4=Other
   5=DOS12     6=DOS16       7=DOSEXT     8=DOSBIG
   9=DOS16LBA  A=x86 Boot    B=Diagnostic C=FAT32
   D=FAT32LBA  E=DOSEXTLBA   F=EFI        0=Exit? 


There are two FAT32 options. the first is just basic fat.
The second, FAT32LBA, is meant for external devices so that
is what we want for a usb flash drive. So we will lay the
track as D and 100%.

Should this become the active partition? If yes, it  will be activated
each time the computer is reset or turned on.
Please type "y" or "n". n


When this dialog is displayed, say no. If you make the partition active,
you may have problems with your computer attempting to boot your drive
on startup.

Now that we have created the fdisk table, we can exit ( 6 not 7 ). 6
will update the configuration but 7 will cancel, so don't choose 7.

now we have to format it.
To do this, we will use mkfs which creates a filesystem of the specified
type on the media device. Make sure the specified filesystem matches the
fdisk table you just set. We will also have to declare additional options
to specify that the fat type is 32 not the default 16. So the syntax will
be:
# mkfs -F <fstype> -o <specific options> <logical node>


There are many fstypes including, but not limited to:
ufs - Unix File System
zfs - Zoned File System
pcfs - Personal Computer File System
ntfs - New Technology File System
hfs - Hierarchical File System
htfs - High Throughput File System
eafs - Enhanced Acer File System
nfs - Network File System
vfs - Veritas File System
... And theres a great deal more.

The fstype for this purpose is going to be pcfs. its a basic type that will
work for most platforms.

So our call to mkfs should look like this:
# mkfs -F pcfs -o fat=32 /dev/rdsk/c6t0d0p0:c
Construct a new FAT file system on /dev/rdsk/c6t0d0p0:c: (y/n)? y

This will take a few seconds depending on your device.
now its formatted and HAL will automatically mount it
on both unix and windows systems.

To mount it manually:
make the directory where you want to mount it:
# mkdir /media/disk/

then use mount as filesystem: pcfs
The Syntax for mount looks like this:
mount -F <fstype> <logical node> <mount point>

So to mount c6t0d0p0 to /media/disk
# mount -F pcfs /dev/dsk/c6t0d0p0:1 /media/disk

Now you're done,
Enjoy!

~Wes

Is This A Good Question/Topic? 0
  • +

Page 1 of 1