Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1015, default 1015): +30M
Create a new primary partition number 2, taking up the rest of the drive:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (467-1015, default 467): ENTER
Using default value 467
Last cylinder or +size or +sizeM or +sizeK (467-1015, default 1015): ENTER
Using default value 1015
Print the partition table to check it:
Command (m for help): p
Disk /dev/sdb: 65 MB, 65536000 bytes
3 heads, 42 sectors/track, 1015 cylinders
Units = cylinders of 126 * 512 = 64512 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 466 29337 83 Linux
/dev/sdb2 467 1015 34587 83 Linux
Set the type code for the two partitions:
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): L
0 Empty 1e Hidden W95 FAT1 80 Old Minix be Solaris boot
1 FAT12 24 NEC DOS 81 Minix / old Lin bf Solaris
2 XENIX root 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT-
...(snip)...
9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM df BootIt
a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e1 DOS access
b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O
c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS e4 SpeedStor
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs
...(snip)...
1c Hidden W95 FAT3 75 PC/IX
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): c
Changed system type of partition 2 to c (W95 FAT32 (LBA))
Write (save) and exit:
Command (m for help): w
The partition table has been altered!
Calling ioctl( ) to re-read partition table.
Syncing disks.
The partition type used, c , indicates that the partition will contain a FAT filesystem. This enables compatibility with Windows and Mac OS X systems and is also necessary for most camera flash-memory cards and digital music players.
Once the partitions have been created, they can be formatted with mkfs :
# mkfs -t vfat -n spreadsheet -F 32 /dev/sdb1
mkdosfs 2.10 (22 Sep 2003)
# mkfs -t vfat -n database -F 3 2 /dev/sdb2
mkdosfs 2.10 (22 Sep 2003)
You may need to remove and reinsert the drive to force the kernel to load the new partition table before you can format the partitions.
The option -F 32 forces the use of 32-bit file allocation tables, which is not strictly necessary for drives under 512 MB in size but is required for larger drives and matches the filesystem type assigned to the partition by the previous fdisk command. The -n labelname option sets the filesystem label, which will be used to determine the mount points for the filesystem.
If you have ever used your USB drive without a partition table (formatting /dev/sda instead of /dev/sda1, for example), erase the master boot record (MBR) before partitioning to prevent udev from later detecting the drive as unpartitioned and mounting it incorrectly:
# dd bs=1k count=1 if=/dev/zero of=/dev/sdb
2.8.3.2. ...using a Linux filesystem such as ext2 on a USB storage device?
You can use ext2 or any other filesystem on a USB storage device, but that will reduce compatibility with other systems. To format the partition /dev/sdb2 with an ext3 filesystem:
# mkfs -t ext3 /dev/sdb2
2.8.3.3. ...accessing USB storage from a nongraphical application?
Automatically mounted storage media are mounted to the directory /media/<label> if the filesystem has a volume label, or to /media/disk<-N > if there is no volume label, where <-N> is a sequentially assigned number (the first disk mounted is simply called /media/disk ).
2.8.3.4. ...manually mounting a USB storage device?
When you're in runlevel 3 (character mode), your USB storage devices won't be automatically mounted. You can still use USB storage; you just have to mount it by hand:
# mkdir /mnt/usbdisk1
# mount /dev/sda1 /mnt/usbdisk1
The SCSI disk IDs are sequentially assigned (the first USB disk found since boot is /dev/sda , the second is /dev/sdb , and so forth) but you may need to experiment to find the right value.
When you're done with the storage device, unmount it before unplugging it:
# umount /mnt/usbdisk1
The unmount command is spelled umount; there's only one n.
2.8.4. Where Can I Learn More?
The USB Implementors Forum, Inc. (USB standards): http://www.usb.org/home
The Linux USB project: http://www.linux-usb.org/
The Udev project: http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
Fedora documentation on Udev: http://fedora.redhat.com/docs/udev/
The GNOME and KDE online manuals
Chapter 3. Using Fedora on Your Notebook