[conspire] GNU parted *won't* create an ext3 file system - argh!

Rick Moen rick at linuxmafia.com
Fri Apr 2 13:13:54 PDT 2010

Quoting Darlene Wallach (freepalestin at dslextreme.com):

> Rick,
> On Fri, Apr 2, 2010 at 12:37 AM, Rick Moen <rick at linuxmafia.com> wrote:
> > Quoting Darlene Wallach (freepalestin at dslextreme.com):
> >
> >> I finally realized that when I thought I had successfully created an
> >> ext3 file system on partition 1 - no file system had been created -
> >> argh!
> >
> > Er...
> >
> > I hope you realise that _partitioning_ utilities are basically to create
> > and edit partition tables.  That includes allocating space in the
> > partition table for where partitions will later be.  Once you're done
> > creating the partition table and allocating space, you close / leave the
> > partitioning table.  As a second, separate step, you mkfs the actual
> > partitions, using entirely different, _formatting_ AKA mkfs software,
> > such as mkfs.ext3.
> I used GNU parted:
> parted /dev/sdb
> parted) mklabel gpt
> parted) mkpart primary ext3 0 960GB
> parted) mkpart primary ext3 960GB 1000GB
> parted) print
> When I printed /dev/sdb the filesytem was blank. There was no
> filesystem. So since I had successfully made the gpt partition table,
> I should have quit GNU parted and just used mkfs.ext3 to make the ext3
> filesystem. 
> If I want to try it again are these the steps that should
> do I want using GNU parted and mkfs.ext3?

Again, I'm at a significant disadvantage, in that I've literally never
used this tool at all (and have no experience with GPTs).  Accordingly,
I hope you realise that, when you ask me these questions, all I really
do, and all I really can do, is try to look stuff up in the GNU parted
manual (http://www.gnu.org/software/parted/manual/parted.html)

> 1. GNU parted /dev/sdb


> mklabel gpt

OK, that creates an (empty) GPT-type partition table.  You could,
instead, type "mklabel msdos" to create an old-style IBM/Microsoft
partition table.

Please note that this command overwrites any partition table you might
have had in place on that drive already.

Also, I _gather_ that GNU parted, unlike /sbin/fdisk and /sbin/cfdisk,
writes changes to the disk immediately when you issue program commands.
The other programs write nothing to the disk until you issue the "write"
command before leaving the program.

This is an important distinction:  In the other two, older programs, you
can doodle around with a prototype partition layout for a while, but
then at the last minute change your mind and exit without saving,
thereby leaving the partition table unchanged.

I hope I've adequately made the point, by the way, that you do _not_
need to use a GUID Paritition Table, and you do _not_ need GNU parted /
GParted / etc.  You _can_ just use your choice of /sbin/fdisk or
/sbin/cfdisk and an old-style IBM/Microsoft-type partition.  Because
you're not creating or manipulating partitions larger than 4 TB, you are
free to use the older tools and partition table type, if you wish.

I mention this because you keep gravitating towards GUID Parititon
Tables and GNU parted / GParted, and I really don't know why.  If you
like them, great.  If you want to start working with the Wave of the
Future<tm> ASAP, fine.  I just wanted to make sure you know you don't
have to.

> q

No.  Wait.  You're not done.  You have an _empty_ partition table.

Looks like you're going to want to do either

1) If your partition table is of type "gpt":

parted) mkpart ext2 DataPartition 0 960GB
parted) mkpart ext2 BackupPartition 960GB 1000GB
parted) print


2) If your partition table is of type "msdos":

parted) mkpart primary ext2 0 960GB
parted) mkpart primary ext2 960GB 1000GB
parted) print

Why "ext2"?  Because I read the manual:

   2.4.7 mkpart

   -- Command: mkpart [part-type fs-type name] start end

   Creates a new partition, _without_ creating a new file system on that
   partition. This is useful for creating partitions for file systems (or
   LVM, etc.) that Parted doesn't support. You may specify a file system
   type, to set the appropriate partition code in the partition table for
   the new partition. fs-type is required for data partitions (i.e.,
   non-extended partitions). start and end are the offset from the
   beginning of the disk, that is, the "distance" from the start of
   the disk.

    part-type is one of "primary", "extended" or "logical", and may be 
    specified only with "msdos" or "dvh" partition tables. A name must 
    be specified for a "gpt" partition table. Neither part-type nor 
    name may be used with a "sun" partition table. 
    fs-type must be one of these supported file systems:

        * ext2
        * fat16, fat32
        * hfs, hfs+, hfsx
        * linux-swap
        * NTFS
        * reiserfs
        * ufs 


              (parted) mkpart logical 0.0 692.1

    Create a logical partition that will contain an ext2 file system.
   The partition will start at the beginning of the disk, and end 692.1
    megabytes into the disk. 

As I said before, ext2 and ext3 are exactly the same -- type 83  in
old-style partition tables -- except that you format ext3 to have 
and use a write journal, and, if you don't do that, it's ext2.

ext2 is ext3 without a journal.  ext3 is ext2 with (plus) a journal.
You can literally take an existing ext2 filesystem, add a journal
feature to it, and remount it as ext3.  That's how practically all of us
migrated our existing filesystems from ext2 to ext3 in the first place.
No reformatting necessary.

OK, _now_ you can quit GNU parted, having created not only a partition
table (or your desired type, either GPT or IBM/Microsoft aka "msdos"),
but also defined the partition table _entries_ for partitions you wish
to exist.

> 2. mkfs.ext3 -c -c -L <LabelFor-sdb1> /dev/sdb1 # if I want the slower
> checks for bad blocks
>    mkfs.ext3 -c -L <LabelFor-sdb1> /dev/sdb1 # if I want the faster
> checks for bad blocks
>    mkfs.ext3 -L <LabelFor-sdb1> /dev/sdb1 # if I don't want to check
> for bad blocks
> That should do it?

That part is correct (except obviously you want to do the same for
/dev/sdb2).  Also, I have no idea why you're creating filesystem labels 
(the -L option).  Personally, I loathe those, for reasons I've already
explained, and they're also regarded as quite _obsolete_, having been
supplanted by the not-quite-as-loathesome UUIDs.

More information about the conspire mailing list