[Lvlug] Using a Linux filesystem (ext2, ext3) on a USB pendrive?

Caleb Shay caleb at webninja.com
Wed Aug 22 11:40:18 EDT 2007


On 8/22/07, Randy Kramer <rhkramer at gmail.com> wrote:

> My goal is to be able to use long filenames on the pendrive without having
> them shortened to things like "testfi~1.txt" or whatever--hmm, maybe fat32
> does that and preserves the Windows compatibility (in case I want to do
> something at a public library or similar)?
>
> Any hints or warnings appreciated.
>

There are 2 major types of pendrives.  The one's that act like a hdd
and the one's that act like a floppy.  The hdd one's are more common
these days, but check anyway.  'fdisk -l' will of course spit out the
partitions of all of your drives.  Locate the pendrive in there and
see if it is actually partitioned.  An unpartitioned one is the floppy
style, otherwise, it will have at least one partition, though it may
not be partition 1.  Some products (Zip disks come to mind) only have
a partition 4.

Anyhow, once you have the partitioning layout issue resolved, it's
just a matter of partition types, formatting, and mount options.  If
you have Windows machines that you have to use, then fat32 is your
best bet, otherwise, ext2/3 would be fine, or look into JFFS which
will do automagical wear-leveling to prolong the life of your
flash-based device.

In the following examples I am going to assume that your device is
/dev/sdc, and that it uses the first partition, and that you want the
volume label to be "MyStick".

Assuming fat32:
The partition type should be 0b (use fdisk or cfdisk to set the partition type)
mkfs.vfat -n MyStick /dev/sdc1
mount -t vfat /dev/sdc1 /mnt/stick (or whatever)

Assuming ext2/3:
The partition type should be 83
mke2fs -j -L MyStick /dev/sdc1 (remove the -j for ext2)
mount -t ext3,ext2 /dev/sdc1 /mnt/stick

Cheers,

Caleb

-- 
"In wine there is wisdom. In bier there is strength. In water there is
bacteria."

--German Proverb


More information about the Lvlug mailing list