The procedures described here will partition the flash memory device in two pieces -- one of the partitions will be formatted in ext2 and the other in vfat. This may be handy when the device is to be used to transport data between two (or more) Linux machines (ext2) and between Linux and Windows machines (vfat)
The device mapped to /dev/sda will be re-formatted. Any data present on it will be destroyed. To make sure that the device you work with is the one intended, remove similar devices from the USB-bus before starting these procedures.
In this section we describe how to set up a dual partition for the memory stick: One half of the device will be devoted to the vfat filesystem, and the other will be ext2. In this way your device will be more versatile, but also a little shattered. The procedure will be given in somewhat less detailed than in Section 8.1 . Note that the procedure of the previous section is repeated and that the hex code for each file type is explicitly entered (lines following the entry "t": Win95 = b; Linux = 83). When the partition will only be for Linux, this is unnecessary -- Linux is the default. Also note that the vfat partition goes on first -- that is the way Windows would have it.
# fdisk /dev/sda Command (m for help): d Selected partition 1 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-888, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-888, default 888):444 Command (m for help): t Selected partition 1 Hex code (type L to list codes): b Changed system type of partition 1 to b (Win95 FAT32) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (445-888, default 445): Using default value 445 Last cylinder or +size or +sizeM or +sizeK (445-888, default 888): Using default value 888 Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): 83 Command (m for help): p Disk /dev/sda: 131 MB, 131072000 bytes 9 heads, 32 sectors/track, 888 cylinders Units = cylinders of 288 * 512 = 147456 bytes Device Boot Start End Blocks Id System /dev/sda1 1 444 63920 b Win95 FAT32 /dev/sda2 445 888 63936 83 Linux Command (m for help):w
Note that we went on with the second partition before writing.
The choice of splitting the device right in the middle (1--444; 445--888 for a 128 MB memory stick) is arbitrary. Any other well-conceived splitting would be fine.
If you had more than one partition to begin with, the "delete" part of the procedure would have to be repeated.
This step is a repetition of Section 8.2. The first step makes the dos partition, the second makes the Linux ext2 partition.
# mkdosfs -F 32 /dev/sda1 # mke2fs /dev/sda2
# mount -t vfat /dev/sda1 /mnt/fatstick # mount -t ext2 /dev/sda2 /mnt/memstick
to mount both partitions on your device.
The Linux machine you did the partitioning on, will be configured for the dual partition. Evidently you need to carry the keychain to another Linux machine. There you will find that it only sees /dev/sda1. This is, perhaps, a shortcoming of the kernel. The workaround is as follows: On the new host machine do (keychain plugged in but not mounted)
# fdisk /dev/sda Choose p; check partition table If satisfied, choose w # less /proc/partitions
Your device with its partitions should be there. Data on your keychain should be untouched. For a single partition this is not necessary.