formatting protected USB memory sticks
Karl Larsen
k5di at zianet.com
Sat May 31 20:45:38 UTC 2008
Colin Rowat wrote:
> Thank you Karl and Dan.
>
> Could you walk me through the console commands that I should run?
>
How to configure a hard drive or USB memory Stick
1. Find the name of your memory:
The first thing you need to do is find out where the hard drive
is located. Hard drives are usually /dev/hda2 or like that. Memory
sticks are usually like /dev/sdf1 and the way to tell which your's is is
to use df.
In a terminal window type df and you see a bunch of hard drive
listed. Now plug in your USB memory and then do df again. My USB memory
is partitioned into 2 types of file system. One has VFAT and it has the
name windows. The other large partition and is maned ext3. Here is how
it looks when you use df:
/dev/sdf1 986024 4 986020 1% /media/windows
/dev/sdf2 2909452 69952 2691704 3% /media/ext3
Your new USB memory may show many partitions that are strange to Linux.
They will be fixed and look like the above.
2. Un-mount the hard drive or USB memory:
In a terminal type sudo umount /dev/sdf1 and give your password.
Then do it again for /dev/sdf2. And any others you want un-mounted.
3. Run fdisk to remove, make partitions:
For example I will say my memory is /dev/sdf and I want to use
fdisk to change things. To use fdisk in a terminal type sudo fdisk
/dev/sdf and give your password. You get this:
karl at karl-desktop:~$ sudo fdisk /dev/sdf
[sudo] password for karl:
Command (m for help):
If you type m it gives you a list of commands. I remember most so I will
use p which Prints a list of all the partitions. It looks like this on
my USB memory:
Command (m for help): p
Disk /dev/sdf: 4043 MB, 4043308544 bytes
255 heads, 63 sectors/track, 491 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x91f72d24
Device Boot Start End Blocks Id System
/dev/sdf1 * 1 123 987966 e W95 FAT16 (LBA)
/dev/sdf2 124 491 2955960 83 Linux
There are two partitions one for windows files and another for Linux
files. This is what I wanted. Before using fdisk it was a mess!
Now to explain something important. If you end fdisk with a q it
changes nothing. If you end with a w as in write, it will change the
hard disk to the current settings in fdisk.
So first I will remove /dev/sdf1 which is done with d and is
shown here:
Command (m for help): d
Partition number (1-4): 1
Command (m for help): p
Disk /dev/sdf: 4043 MB, 4043308544 bytes
255 heads, 63 sectors/track, 491 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x91f72d24
Device Boot Start End Blocks Id System
/dev/sdf2 124 491 2955960 83 Linux
Command (m for help):
Now I will remove /dev/sdf2 and the memory looks empty.
Disk /dev/sdf: 4043 MB, 4043308544 bytes
255 heads, 63 sectors/track, 491 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x91f72d24
Device Boot Start End Blocks Id System
Command (m for help):
Now if you wanted to change things you can now use n to make a
new partition. I will make it one Linux partition:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-491, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-491, default 491):
Using default value 491
Command (m for help): p
Disk /dev/sdf: 4043 MB, 4043308544 bytes
255 heads, 63 sectors/track, 491 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x91f72d24
Device Boot Start End Blocks Id System
/dev/sdf1 1 491 3943926 83 Linux
Command (m for help):
If I wanted to save this I would use w to exit. But I want to save the
current things so I quit with q.
4. Make a file system for your partition:
You need the target of the file system to be un-mounted. Then in
a terminal we will use mkfs. If you want a windows file-system I use the
following: In a terminal type mkfs.vfat -n name /dev/sdf1 in my case.
For the Linux I use: mkfs.ext3 -L name /dev/sdf2 and that completes the job.
This should help. If it is unclear please say so. I hope this will help
many others.
Karl
--
Karl F. Larsen, AKA K5DI
Linux User
#450462 http://counter.li.org.
PGP 4208 4D6E 595F 22B9 FF1C ECB6 4A3C 2C54 FE23 53A7
More information about the ubuntu-users
mailing list