<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML ><HEAD ><TITLE >Formatting an ext2/3 partition</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Linux Partition HOWTO" HREF="index.html"><LINK REL="PREVIOUS" TITLE="Labels" HREF="labels.html"><LINK REL="NEXT" TITLE="Recovering a Deleted Partition Table" HREF="recovering.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" >Linux Partition HOWTO</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="labels.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="recovering.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="formatting" ></A >7. Formatting an ext2/3 partition</H1 ><P > When a hard drive is partitioned, it is mapped into sections, but the sections are empty. It is like a newly constructed library; shelves, signs, and a card catalogue system must be put in place before the books are put away.</P ><P > The organizational structure inside a partition is called a file system. With Linux, the standard file system is ext2 and ext3. The ext3 file system is ext2, plus a log of disk writes called a journal. The journal allows the system to recover quickly from accidental power outages, among other things. </P ><P > The principal tool for making an ext2/3 file system in a partition is <B CLASS="command" >mke2fs</B >. It is usually found in <TT CLASS="filename" >/sbin</TT >. <B CLASS="command" >mkfs.ext2</B > and <B CLASS="command" >mkfs.ext3</B > are frontends which pass specific options to <B CLASS="command" >mke2fs</B >. </P ><DIV CLASS="sect3" ><H3 CLASS="sect3" ><A NAME="formatting-invocation" ></A >.1. Simple Invocation</H3 ><P > <B CLASS="command" >mke2fs</B > <TT CLASS="filename" >/dev/hdb1</TT > </P ><P > <B CLASS="command" >mkfs.ext2</B > <TT CLASS="filename" >/dev/hdb1</TT > </P ><P > both of which make an ext2 file system on the first partition of the second drive, and </P ><P > <B CLASS="command" >mke2fs</B > -j <TT CLASS="filename" >/dev/hdb1</TT > </P ><P > <B CLASS="command" >mkfs.ext3</B > <TT CLASS="filename" >/dev/hdb1</TT > </P ><P > make an ext3 file system. </P ></DIV ><DIV CLASS="sect3" ><H3 CLASS="sect3" ><A NAME="reservedblocks" ></A >.2. Reserved blocks</H3 ><P > The -m option is probably the one of most use to non-experts. If the file system becomes filled and there is no more space to write, it is basically unusable because the operating system is constantly writing to disk. By default, five percent of the partition is reserved for use by the root user. This allows root to conduct administrative activities on the partition and perhaps move some data off. However, this is most critical when the partition contains / or home directories. For pure data partitions, this is just lost space. Five percent of a 250Gb partition is 12.5 Gb. Especially in the case of large partitions, it is safe to set the reserved space to the minimum, which is one percent. </P ><P > <B CLASS="command" >mkfs.ext3</B > -m 1<TT CLASS="filename" >/dev/hdb1</TT > </P ><P > creates a file system with only 1% of its space reserved for the root user. tune2fs -m can be used to adjust the reserved blocks after data is loaded on the partition. </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="labels.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="recovering.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Labels</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Recovering a Deleted Partition Table</TD ></TR ></TABLE ></DIV ></BODY ></HTML >