Using default value of 9729
And we are back at the fdisk
prompt:
Command (m for help) :
Enter the w
command to write the new partition table to the disk, and fdisk
exits, returning you to the command prompt.
parted
CommandIn the past, Red Hat used a partition editor during its installation process named Disk Druid; the underlying code for Disk Druid has been replaced by GNUparted (also known simply as parted
, the name of the command itself). GNUparted is the GNU partition editor and a very powerful utility. You use parted
to create, delete, move, resize, and copy ext2
, ext3
, and FAT32
partitions. Although GNUparted displays a GUI interface during the installation process, it really is a console utility. GNUparted can be used from the command line.
Creating the File System on the Partitioned Disk
After you partition the disk for a specific file system, you can create the file system on it. In the DOS world, this two-part process is described by DOS as
An unformatted disk storage device (a floppy disk, hard disk drive, or removable media) typically arrives to you with a low-level format, which has been done with a tool such as fdisk
or superformat
. Although the disk might have a boot block and partition information, it typically lacks the file structure needed for a file system.
If you are preparing to create a file system on any device other than a floppy disk, examine it with fdisk
or another utility of your choice and modify the partition table accordingly (following the instructions you saw in the preceding sections of this chapter).
To create the file system structure, you need to do what is sometimes referred to as a high-level format. For FAT
file systems, this is accomplished by the format
command. In Linux, you use the mke2fs -j
command to create an ext3
file system.
If you are creating a Reiser file system, use the mkreiserfs
command. To create a DOS file system, use the mkdosfs
command. Other commands for other file systems include:
> mkfs.ext2
— The ext2
file system
> mkfs.msdos
— The MS-DOS file system
> mkfs.vfat
— The FAT32
file system
mke2fs
to Create the File SystemThe mke2fs
command is used to create both the ext2
and the ext3
file systems. At its simplest, the command is used as:
# mke2fs
such as:
# mke2fs /dev/hdc4
Here are some of the most useful options for mke2fs:
> -c
— This option checks for bad blocks during file system creation.
> -N
— This option overrides the default number of inodes created. (The default number is usually a good choice, but you might need to use this option to allow additional useable disk space.)
> -m
— This option frees up some space on the disk, but you do so at your peril. By default, the system allocates 5% of the blocks to the super-user — to be used in file recovery during fsck
. You can lower that allocation, but you might not leave enough blocks for fsck
to recover enough files.
> -L
— This option gives the volume a label, which is useful if you need to be reminded what the file system is used for; it also provides some flexibility in identifying volumes in /etc/fstab
.
> -S
— This option is a last-ditch effort for recovering a broken file system; it writes only the superblock and descriptors, leaving the information in the inodes unchanged. Always run fsck
after using this option.
As you can see, mke2fs
offers a few options to make more space available for the regular users. But that extra space always comes from the super user's space for recovering damaged files. The default settings accommodate most users, so think carefully before using one of these options. Hard disks are getting less expensive all the time, so adding another might be a better solution.
mkfs.ext3
To make a new ext3
file system, you use the mke2fs
command with the -j
or -J
option, or call the command as mkfs.ext3
. Use the tune2fs
command on an existing ext2
file system to add journaling. You learn how to convert an existing ext2
file system into an ext3
file system later in this chapter. Here, x
represents a partition:
# tune2fs /dev/hd
Some arguments you can use with this command include:
> -j
— This option adds an ext3
journal to the new file system, using the default values. Note that you must be using a kernel that has ext3 support to actually make use of the journal.
> -J
— This option overrides the default ext3
journal parameters so that you can choose the options you desire. The following journal options are comma separated and you can provide an argument by using the =
sign.
> size=journal-size
— This option creates a journal of journal-size megabytes. With a minimum size of 1,024 blocks, it cannot be more than 102,400 blocks. There must be enough free space in the file system to create a journal of that size.
> device=external-journal
— This option associates the file system with a journal not contained within the file system (one that must have already been created with the command mke2fs -O journal_device journal_name
); in other words, the journal and the data files do not have to be on the same device.
The latter two options in the arguments list are mutually exclusive.
To select the ext3
journaling mode, you must add the appropriate entry in /etc/fstab
.
Because the ext3
file system is a new version of the ext2
file system with journaling added, it supports the same options as ext2
, as well as the following additions:
> noload
— This option disables the ext3 file system's journal when mounting; it becomes an ext2
file system.
> data=journal / data=ordered / data=writeback
— This option specifies the journaling mode; ordered
is the default. Metadata is always journaled.