sreda, november 30, 2005

Sharing External FireWire Drives Among Operating Systems

This information is intended specifically for the entire Synchrotech UltiFire hard drive line, which as an employee, I am intimately familiar with. There is no reason I am aware of that the information wouldn't work with other brands. Further, the same would apply to UltiFire drives connected via USB 2.0, although I am not clear why anyone would use USB over FireWire for data transfer. For some time we had customers ask how they could share drives between multiple platforms. Nearly always with Mac OS X and Windows XP. The most natural solution is to format the drives as FAT 32, or at least one partition as such, which is usable under both systems. Unfortunately, Windows XP is incapable of formating large drives as FAT 32. Furthermore, Windows is incapable of creating HFS+/FAT 32 multi-partitions and other combinations as well.

While it goes without saying that Mac OS X is much more flexible in terms of file system support, the Disk Utility Application isn't without limitations. While able to reformat FAT disks (MS-DOS File System in its terminology) that remain readable on Windows, any disk created with combinations of HFS and FAT, or disks once HFS and reformated as FAT are unrecognizable on Windows. Several sites have given suggestions on how to use Mac OS X to create sharable drives, but the examples are confusing, unreliable and often incorrect. The appropriate tool to use is fdisk, which will create up to four partitions recognized by both x86 operating systems and the Macintosh. Once partitioned, there are several tools available to format the partitions as needed. In these examples, we will OS X 10.3.x. FreeBSD and Linux support FireWire, OpenBSD and NetBSD are adding support. The basic process here should work essentially the same for those systems as well.

Creating Single Partitioned File Systems for Multiple OSs

These instructions are all done at the command line and several of them require administrative privileges. Other than diskutil, these programs are pretty standard on any Unix-like system. An existing UltiFire drive would already be formated, but for completeness we will discuss dealing with both pre-formatted and un-formated drives. Connecting or powering on a drive with a supported file system causes OS X to mount the drive its partitions. These partitions will need unmounting before going any further. Connecting or powering on a drive without a supported file system causes OS X to present the following dialog: "You have inserted a disk containing no volumes that Mac OS X can read. To continue with the disk inserted, click Ignore." Given the choices Initialize..., Ignore, and Eject choose Ignore.

There are several ways to unmount partitions, because the OS X Finder sometimes doesn't deal with umount well, it is best to use diskutil. First we determine the full path to non-root volume(s) in question by typing mount | grep /Volumes. We can then use diskutil to unmount the UltiFire drive.

[kyoto:~] rds% mount | grep /Volumes
/dev/disk0s9 on /Volumes/os9 (local, journaled)
/dev/disk2s1 on /Volumes/ultifire (local, nodev, nosuid)

[kyoto:~] rds% diskutil unmount /Volumes/ultifire/
Any drive formated with Apple's Disk Utility or Drive Setup applications use the Apple partitioning scheme. Drives formated under Windows as NTFS have an improper MBR entry. This won't work for sharing drives, so we need to change the partition scheme to fdisk. Rather than use the interactive mode, we can provide everything at the command prompt. Note that we use the device we saw when calling mount, but with an "r" prefix and without the slice information afterwards (ie. /dev/disk2s1 becomes /dev/rdisk2). After the partition table is changed, OS X will present the dialog mentioned above; choose Ignore.

[kyoto:~] rds% fdisk -ia dos /dev/rdisk2
fdisk: could not open MBR file /usr/standalone/i386/boot0: No such file or directory

-----------------------------------------------------
------ ATTENTION - UPDATING MASTER BOOT RECORD ------
-----------------------------------------------------

Do you wish to write new MBR and partition table? [n] y
We can verify if the MBR is correct, and create a new FAT 32 file system on the partition using newfs_msdos. We use the device name as we saw when we originally called mount | grep /Volumes. The disk will now be usable for any operating system that can deal with FAT 32. A short list includes: Mac OS X and 9, any version of Windows that supports FireWire or USB 2.0, FreeBSD, Linux, and more.

[kyoto:~] rds% fdisk /dev/rdisk2
Disk: /dev/rdisk2 geometry: 10011/255/63 [160836480 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
*1: 0C 0 1 1 - 1023 154 63 [ 63 - 160836417] Win95 FAT32L
2: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused


[kyoto:~] rds% newfs_msdos -F32 -v ultifire /dev/disk2s1
newfs_msdos: warning: /dev/disk2s1 is not a character device
/dev/disk2s1: 160797120 sectors in 2512455 FAT32 clusters (32768 bytes/cluster)
bps=512 spc=64 res=32 nft=2 mid=0xf0 spt=32 hds=255 hid=0 bsec=160836417
bspf=19629 rdcl=2 infs=1 bkbs=6

[kyoto:~] rds% diskutil mount /dev/disk2
Creating Multiple Partitioned File Systems for Multiple OSs

This option is useful in several regards. Mac OS X users might want to use a portion of the disk for backups and part for sharing data with Windows. A Windows XP users might want a partition as NTFS, and a FAT 32 partition for exchanging files with Linux. Rather than repeat all details, please read the above section carefully. Apple's diskutil will do this straight from the command line:

[kyoto:~] rds% diskutil partitionDisk disk2 2 MBRFormat HFS+ mac 46.7G MS-DOS dos 30G

[kyoto:~] rds% fdisk /dev/rdisk2
Disk: /dev/rdisk2 geometry: 10011/255/63 [160836480 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: AF 0 0 9 - 1023 75 43 [ 8 - 97937000] HFS+
2: 05 1023 75 44 - 1023 154 63 [ 97937008 - 62899472] Extended DOS
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 0B 1023 75 52 - 1023 154 63 [ 97937016 - 62899464] Win95 FAT-32
2: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused

[kyoto:~] rds% diskutil list

/dev/disk2
#: type name size identifier
0: FDisk_partition_scheme *76.7 GB disk2
1: Apple_HFS mac 46.7 GB disk2s1
2: DOS_FAT_32 DOS 30.0 GB disk2s5
OS9 will only recognize the FAT partions on a MBR partitioned disk, so this option isn't well suited for OS9 installations.

Innovation, Not Litigation

Using XP, from the company currently licensing FAT 32 we have two choices. The seemingly obvious tool--Disk Manager, only provides NTFS as an option. So we are left with command line:

C:\Documents and Settings\rds>format F: /FS:FAT32
The type of the file system is NTFS.
The new file system is FAT32.
Enter current volume label for drive F: ULTIFIRE

WARNING, ALL DATA ON NON-REMOVABLE DISK
DRIVE F: WILL BE LOST!
Proceed with Format (Y/N)? y
Verifying 238475M
The volume is too big for FAT32.
I suppose the 'innovation' of FAT32 which is now being licensed at a steep price to media manufacturers isn't considered innovative enough for WinXP. Older versions of Windows might fare better, an exercise left to the reader.

taken from here

Oznake:

nakracal samuelion ob 09:41, |

kraca: 0