From: Thomas Maier-Komor on
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

does anybody know how one can set the volume label on a usb stick?

# uname -a
SunOS anduril 5.10 Generic_118833-03 sun4u sparc SUNW,Sun-Blade-1000
# fmthard -n usbstick /dev/rdsk/c4t0d0s2
fmthard: Cannot open device /dev/rdsk/c4t0d0s2 - Device busy
# /etc/init.d/volmgt stop
# fmthard -n usbstick /dev/rdsk/c4t0d0s2
/dev/rdsk/c4t0d0s2: Cannot get disk geometry

Any idea? It used to be set until I had to dd if=/dev/zero it, because
of messing around with filesystems ;-)

TIA,
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (SunOS)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEK+Wr6U+hp8PKQZIRAhk6AJ9kndfLYkPce6lJfD1t8o1Y3NKi0gCgz9yy
vrLXTrsQ9prJ/yRgb8sys60=
=GK8U
-----END PGP SIGNATURE-----
From: Juergen Keil on
Thomas Maier-Komor <thomas(a)maier-komor.de> writes:


> does anybody know how one can set the volume label on a usb stick?

"format -e" works.

But you should avoid format's disk parameter "Auto configure"; USB
sticks don't implement the necessary scsi commands.


You can use an /etc/format.dat entry instead. I just tried this:


Find the capacity of the device, by running iostat -En while
some process has the usb stick opened...

# sleep 20 < /dev/dsk/c6t0d0s2 &
[1] 1733


# iostat -En
....
c6t0d0 Soft Errors: 7 Hard Errors: 0 Transport Errors: 0
Vendor: Prolific Product: UsbFlashDisk Revision: 1.00 Serial No: Size: 0.02GB <16777216 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 7 Predictive Failure Analysis: 0
....


16777216 bytes / 512 bytes/sector => 32768 sectors

Compute a disk geometry. I used 64 sectors/track * 2 heads * 256 cylinders
==> 32768 sectors total. Or these new /etc/format.dat entries:


disk_type = "Prolific USB 16MB" \
: ctlr = SCSI \
: ncyl = 256 : acyl = 0 : pcyl = 256 : nhead = 2 : nsect = 64 \
: rpm = 2941 : bpt = 16384

partition = "Prolific USB 16MB" \
: disk = "Prolific USB 16MB" : ctlr = SCSI \
: 0 = 0, 32768 : 2 = 0, 32768



# format -e
Searching for disks...done


AVAILABLE DISK SELECTIONS:
0. c0t0d0 <IBM-DPSS-318350N-S96H cyl 14278 alt 2 hd 5 sec 502>
/pci(a)1f,4000/scsi@3/sd@0,0
...
4. c6t0d0 <drive type unknown>
/pci(a)1f,4000/pci@4/pci9710,35@6/hub@2/hub@1/storage@2/disk@0,0
Specify disk (enter its number): 4



AVAILABLE DRIVE TYPES:
0. Auto configure
1. Quantum ProDrive 80S
2. Quantum ProDrive 105S
3. CDC Wren IV 94171-344
4. SUN0104
5. SUN0207
6. SUN0327
7. SUN0340
8. SUN0424
9. SUN0535
10. SUN0669
11. SUN1.0G
12. SUN1.05
13. SUN1.3G
14. SUN2.1G
15. SUN2.9G
16. Zip 100
17. Zip 250
18. Peerless 10GB
19. Prolific USB 16MB
20. IBM-DPSS-318350N-S96H
21. IBM-DPSS-336950N-S96H
22. IFT-SR2500-327J
23. IFT-SR2500-0323
24. other
Specify disk type (enter its number): 19
selecting c6t0d0
[disk formatted]


FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
repair - repair a defective sector
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
inquiry - show vendor, product and revision
scsi - independent SCSI mode selects
cache - enable, disable or query SCSI disk cache
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format> part


PARTITION MENU:
0 - change `0' partition
1 - change `1' partition
2 - change `2' partition
3 - change `3' partition
4 - change `4' partition
5 - change `5' partition
6 - change `6' partition
7 - change `7' partition
select - select a predefined table
modify - modify a predefined partition table
name - name the current table
print - display the current table
label - write partition map and label to the disk
!<cmd> - execute <cmd>, then return
quit
partition> print
Current partition table (Prolific USB 16MB):
Total disk cylinders available: 256 + 0 (reserved cylinders)

Part Tag Flag Cylinders Size Blocks
0 root wm 0 - 255 16.00MB (256/0/0) 32768
1 swap wu 0 0 (0/0/0) 0
2 backup wu 0 - 255 16.00MB (256/0/0) 32768
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 usr wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0

partition> label
[0] SMI Label
[1] EFI Label
Specify Label type[0]: 0
Ready to label disk, continue? y


Warning: Current geometry overshoots actual geometry of disk

Continue labelling disk? y
partition> ^D


# prtvtoc /dev/rdsk/c6t0d0s2
* /dev/rdsk/c6t0d0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 64 sectors/track
* 2 tracks/cylinder
* 128 sectors/cylinder
* 256 cylinders
* 256 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 0 32768 32767
2 5 01 0 32768 32767
From: Thomas Maier-Komor on
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Juergen Keil wrote:
> Thomas Maier-Komor <thomas(a)maier-komor.de> writes:
>
>
>> does anybody know how one can set the volume label on a usb stick?
>
> "format -e" works.
>
> But you should avoid format's disk parameter "Auto configure"; USB
> sticks don't implement the necessary scsi commands.
>
>
[snipped very long and detailed procedure to label the stick]

Thanks J?rgen for this detailed procedure. But I guess I pointed you
into the wrong direction. I want to write a volume label not a disk
label. I.e. the name that is placed in /rmdisk by the vold after
mounting the device. Normally it is somehow associated with the FAT
filesystem. But doing a
$ mkfs -F pcfs -o b=diskname /dev/c9t0d0s2:c
does not change the name to "diskname".

So I guessed wildly that with fmthard it might be possible to set the
name. But I was wrong concerning this, which I found out after going
through your procedure and finding out that it effectively invalidates
the fdisk partition table and fmthard bails out with a "cannot stat device".

Any other ideas?

Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (SunOS)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFELCRg6U+hp8PKQZIRAizGAKCA0EPgkHtTWNzdvC9LBM92mh2cJwCgky0B
2Bqaopo5RNYuEuEmWkUPmto=
=IVvx
-----END PGP SIGNATURE-----
From: Richard L. Hamilton on
In article <e0h87m$hv6$1(a)wsc10.lrz-muenchen.de>,
Thomas Maier-Komor <thomas(a)maier-komor.de> writes:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Juergen Keil wrote:
>> Thomas Maier-Komor <thomas(a)maier-komor.de> writes:
>>
>>
>>> does anybody know how one can set the volume label on a usb stick?
>>
>> "format -e" works.
>>
>> But you should avoid format's disk parameter "Auto configure"; USB
>> sticks don't implement the necessary scsi commands.
>>
>>
> [snipped very long and detailed procedure to label the stick]
>
> Thanks J?rgen for this detailed procedure. But I guess I pointed you
> into the wrong direction. I want to write a volume label not a disk
> label. I.e. the name that is placed in /rmdisk by the vold after
> mounting the device. Normally it is somehow associated with the FAT
> filesystem. But doing a
> $ mkfs -F pcfs -o b=diskname /dev/c9t0d0s2:c
> does not change the name to "diskname".
>
> So I guessed wildly that with fmthard it might be possible to set the
> name. But I was wrong concerning this, which I found out after going
> through your procedure and finding out that it effectively invalidates
> the fdisk partition table and fmthard bails out with a "cannot stat device".
>
> Any other ideas?

Format the stick on windows, or use mkfs -F pcfs -o b=label
or use fdformat (haven't looked up the details). That's assuming you're
trying to label a pcfs filesystem.


--
mailto:rlhamil(a)smart.net http://www.smart.net/~rlhamil

Lasik/PRK theme music:
"In the Hall of the Mountain King", from "Peer Gynt"
From: Thomas Maier-Komor on
Richard L. Hamilton wrote:
> In article <e0h87m$hv6$1(a)wsc10.lrz-muenchen.de>,
> Thomas Maier-Komor <thomas(a)maier-komor.de> writes:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Juergen Keil wrote:
>>> Thomas Maier-Komor <thomas(a)maier-komor.de> writes:
>>>
>>>
>>>> does anybody know how one can set the volume label on a usb stick?
>>> "format -e" works.
>>>
>>> But you should avoid format's disk parameter "Auto configure"; USB
>>> sticks don't implement the necessary scsi commands.
>>>
>>>
>> [snipped very long and detailed procedure to label the stick]
>>
>> Thanks J?rgen for this detailed procedure. But I guess I pointed you
>> into the wrong direction. I want to write a volume label not a disk
>> label. I.e. the name that is placed in /rmdisk by the vold after
>> mounting the device. Normally it is somehow associated with the FAT
>> filesystem. But doing a
>> $ mkfs -F pcfs -o b=diskname /dev/c9t0d0s2:c
>> does not change the name to "diskname".
>>
>> So I guessed wildly that with fmthard it might be possible to set the
>> name. But I was wrong concerning this, which I found out after going
>> through your procedure and finding out that it effectively invalidates
>> the fdisk partition table and fmthard bails out with a "cannot stat device".
>>
>> Any other ideas?
>
> Format the stick on windows, or use mkfs -F pcfs -o b=label
> or use fdformat (haven't looked up the details). That's assuming you're
> trying to label a pcfs filesystem.
>
>

as you can read above, I tried exactly this, but didn't get the result I
expected...