Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > 965e33040dd61030a94f0eb89877aee8 > files > 1158

howto-html-en-20080722-2mdv2010.1.noarch.rpm

<HTML
><HEAD
><TITLE
>Using a file instead of a partition</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Cryptoloop HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Mounting the encrypted file system"
HREF="mounting-filesystem.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"
>Cryptoloop HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="mounting-filesystem.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
>&nbsp;</TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="filebased"
></A
>7. Using a file instead of a partition</H1
><P
>&#13;It is just as easy to create an encrypted file system within a file on another file system. This is especially useful
if you want to back up this file by burning it to a DVD, etc. You can then easily move the file around to other
machines as well.
</P
><P
>To initially create a 100MB file containing random data use the following command:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>dd if=/dev/urandom of=/mystuff.aes bs=1k count=100000</PRE
></FONT
></TD
></TR
></TABLE
><P
>&#13;If you want to change the size of the file, change the <TT
CLASS="varname"
>count</TT
> value accordingly. The above command creates 100000 blocks
of 1k in size, but you can change this to whatever you like. Just make sure it is not too small to hold the file system you
chose. You can choose any file name and path you want instead of <TT
CLASS="filename"
>/mystuff.aes</TT
> as long as there's enough space on the partition.
</P
><P
>You can then create the encrypted file system within this file, similar to the way it is done above:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>losetup -e aes-256 /dev/loop0 /mystuff.aes</PRE
></FONT
></TD
></TR
></TABLE
><P
>Now you can create the file system:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;mkfs.ext3 /dev/loop0
</PRE
></FONT
></TD
></TR
></TABLE
><P
>&#13;and mount it:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;mount -t ext3 /dev/loop0 /mnt/crypto
</PRE
></FONT
></TD
></TR
></TABLE
><P
>&#13;Finally, unmount and detach the loop device:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;umount /mnt/crypto
losetup -d /dev/loop0
</PRE
></FONT
></TD
></TR
></TABLE
><P
>&#13;You can then mount the file system later on as follows:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>mount /mystuff.aes /mnt/crypto -oencryption=aes-256</PRE
></FONT
></TD
></TR
></TABLE
><P
>If you want to move the file or burn it to a CD or DVD, make sure you <B
CLASS="command"
>unmount</B
> it first.
</P
></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="mounting-filesystem.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"
>&nbsp;</TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Mounting the encrypted file system</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>&nbsp;</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>