old-www/HOWTO/Flash-Memory-HOWTO/mixed.html

652 lines
10 KiB
HTML

<HTML
><HEAD
><TITLE
> Setting up a dual partition</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="USB Flash Memory HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE=" Setting up an Ext2 filesystem"
HREF="ext2.html"><LINK
REL="NEXT"
TITLE=" Making the memory stick accessible to users"
HREF="users.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>USB Flash Memory HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="ext2.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="users.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="mixed"
></A
>9. Setting up a dual partition</H1
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="double-partition"
></A
>9.1. Partitioning</H2
><P
>&#13; 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)
</P
><DIV
CLASS="important"
><P
></P
><TABLE
CLASS="important"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/important.gif"
HSPACE="5"
ALT="Important"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>&#13; The device mapped to <TT
CLASS="filename"
>/dev/sda</TT
> 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.
</P
></TD
></TR
></TABLE
></DIV
><P
>
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 <A
HREF="ext2.html#partition"
>Section 8.1</A
> . 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.
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13; <TT
CLASS="prompt"
>#</TT
> <TT
CLASS="userinput"
><B
><B
CLASS="command"
>fdisk</B
> /dev/sda</B
></TT
>
<TT
CLASS="prompt"
>Command (m for help):</TT
> <TT
CLASS="userinput"
><B
>d</B
></TT
>
<TT
CLASS="computeroutput"
>Selected partition 1</TT
>
<TT
CLASS="prompt"
>Command (m for help):</TT
> <TT
CLASS="userinput"
><B
>n</B
></TT
>
<TT
CLASS="computeroutput"
>Command action
e extended
p primary partition (1-4)</TT
>
<TT
CLASS="userinput"
><B
>p</B
></TT
>
<TT
CLASS="prompt"
>Partition number (1-4):</TT
> <TT
CLASS="userinput"
><B
>1</B
></TT
>
<TT
CLASS="prompt"
>First cylinder (1-888, default 1): </TT
>
<TT
CLASS="computeroutput"
>Using default value 1</TT
>
<TT
CLASS="prompt"
>Last cylinder or +size or +sizeM or +sizeK (1-888,
default 888):</TT
><TT
CLASS="userinput"
><B
>444</B
></TT
>
<TT
CLASS="prompt"
>Command (m for help):</TT
> <TT
CLASS="userinput"
><B
>t</B
></TT
>
<TT
CLASS="computeroutput"
>Selected partition 1</TT
>
<TT
CLASS="prompt"
>Hex code (type L to list codes):</TT
> <TT
CLASS="userinput"
><B
>b</B
></TT
>
<TT
CLASS="computeroutput"
>&#13; Changed system type of partition 1 to b (Win95 FAT32)
</TT
>
<TT
CLASS="prompt"
>Command (m for help):</TT
> <TT
CLASS="userinput"
><B
>n</B
></TT
>
<TT
CLASS="computeroutput"
>Command action
e extended
p primary partition (1-4)</TT
>
<TT
CLASS="userinput"
><B
>p</B
></TT
>
<TT
CLASS="prompt"
>Partition number (1-4):</TT
> <TT
CLASS="userinput"
><B
>2</B
></TT
>
<TT
CLASS="prompt"
>First cylinder (445-888, default 445): </TT
>
<TT
CLASS="computeroutput"
>Using default value 445</TT
>
<TT
CLASS="prompt"
>&#13; Last cylinder or +size or +sizeM or +sizeK (445-888,
default 888):
</TT
>
<TT
CLASS="computeroutput"
>Using default value 888</TT
>
<TT
CLASS="prompt"
>Command (m for help):</TT
> <TT
CLASS="userinput"
><B
>t</B
></TT
>
<TT
CLASS="prompt"
>Partition number (1-4):</TT
> <TT
CLASS="userinput"
><B
>2</B
></TT
>
<TT
CLASS="prompt"
>Hex code (type L to list codes):</TT
> <TT
CLASS="userinput"
><B
>83</B
></TT
>
<TT
CLASS="prompt"
>Command (m for help):</TT
> <TT
CLASS="userinput"
><B
>p</B
></TT
>
<TT
CLASS="computeroutput"
>&#13; 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
</TT
>
<TT
CLASS="prompt"
>Command (m for help):</TT
><TT
CLASS="userinput"
><B
>w</B
></TT
>
</PRE
></FONT
></TD
></TR
></TABLE
><DIV
CLASS="note"
><P
></P
><TABLE
CLASS="note"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>&#13; Note that we went on with the second partition before writing.
</P
></TD
></TR
></TABLE
></DIV
><P
>&#13; 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.
</P
><P
>&#13; If you had more than one partition to begin with, the "delete"
part of the procedure would have to be repeated.
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="both"
></A
>9.2. Making a dual ext2/vfat system</H2
><P
>
This step is a repetition of <A
HREF="ext2.html#making-ext2"
>Section 8.2</A
>. The first step
makes the dos partition, the second makes the Linux ext2 partition.
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13; <TT
CLASS="prompt"
>#</TT
> <TT
CLASS="userinput"
><B
><B
CLASS="command"
>mkdosfs</B
> -F 32 /dev/sda1</B
></TT
>
<TT
CLASS="prompt"
>#</TT
> <TT
CLASS="userinput"
><B
><B
CLASS="command"
>mke2fs</B
> /dev/sda2</B
></TT
>
</PRE
></FONT
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="mixed-tests"
></A
>9.3. Tests -- ext2 and vfat</H2
><P
>
Simply carry out the tests of <A
HREF="verifications.html#tests"
>Section 7.4</A
> and <A
HREF="ext2.html#tests4"
>Section 8.3</A
> on the two devices separately. The mount commands
would be
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13; <TT
CLASS="prompt"
>#</TT
> <TT
CLASS="userinput"
><B
><B
CLASS="command"
>mount</B
> -t vfat /dev/sda1 /mnt/fatstick </B
></TT
>
<TT
CLASS="prompt"
># </TT
><TT
CLASS="userinput"
><B
><B
CLASS="command"
>mount</B
> -t ext2 /dev/sda2 /mnt/memstick</B
></TT
>
</PRE
></FONT
></TD
></TR
></TABLE
><P
>&#13; to mount both partitions on your device.
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="config-linux"
></A
>9.4. Configuring Linux for the dual partition</H2
><P
>&#13; 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 <TT
CLASS="filename"
>/dev/sda1</TT
>. 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)
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13; <TT
CLASS="prompt"
>#</TT
> <TT
CLASS="userinput"
><B
><B
CLASS="command"
>fdisk</B
> /dev/sda</B
></TT
>
<TT
CLASS="computeroutput"
>Choose p; check partition table
If satisfied, choose w</TT
>
<TT
CLASS="prompt"
>#</TT
> <TT
CLASS="userinput"
><B
><B
CLASS="command"
>less</B
> /proc/partitions</B
></TT
>
</PRE
></FONT
></TD
></TR
></TABLE
><P
>&#13; Your device with its partitions should be there. Data on your
keychain should be untouched. For a single partition this is not
necessary.
</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="ext2.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="users.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Setting up an Ext2 filesystem</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Making the memory stick accessible to users</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>