create ext2 and ext3 filesystem
Remy Card designed ext2 filesystem for the first time. It is a very powerful linux filesystem. For a very long time ext2 was the default filesystem for many linux distributions. In ext2 filesystem data of a file is held in blocks which means that when a filesystem of ext2 type is made the block size is set and will be same for all the blocks holding different kind of data.
For example lets say that the block size of an ext2 filesystem is 1024 bytes then in that case suppose you try to save a file of 1025 bytes then that file will occupy 2 blocks.
And this means that we end up wasting a lot of space.
Some of the blocks in the ext2 filesystem are used to hold the information that describe the structure of the filesystem. It uses inode data for identifying a file.
some of the things that are worth noting in ext2 filesystem are as follows.
1.it does not have a journalling feature
2.Max file size: 16 GB to 2 TB
3.Filesystem size: 2 TB to 32 TB
Creating an ext2 partition:
The first thing to do is to identify the name of the device or partition where you want to create the file system.
this can be done with the help of fdisk command as shown below:
from the above command i ran on my machine you can see that i have one hard disk of 26.8GB and have the following partition in it.
Now let me tell you one thing that in linux machines the naming convention are like this
IDE devices are named as /dev/hda for first IDE disk,/dev/hdb for second and so on.
SCSI devices are named as /dev/sda for first SCSI disk and /dev/sdb for second and so on.
the partition inside these disks are named as /dev/sda1,2,3, etc.
now if you already have a partition find out its name from the above fdisk commands output. Or if you want to create a new partition out of your disk then you need to run the below command instead of the above.
Now we have passed /dev/sda as an argument to fdisk in the above command, because we would like to create partitions inside /dev/sda.
Note: identify your disk or partition name from fdisk -l and if you want to create a partition inside a disk then pass the disk's name as an argument to fdisk
Now lets see how we will create a new partiton inside our /dev/sda. from the above command result as shown above you can press m for listing all the available commands in fdisk. Now we will use the "n" option because we want to create a new partition.
After using the n option you will be told to select the first cylender(just press enter there as the system will by itself select the first cylinder available.)
Now enter the required size of your partition like as shown below:
+300M (for 300 MB)
+100G(for 100 GB)
Now press enter after entering the desired size value. Now give the command "w" to write the partition infor to the partition table.
after that again do an fdisk -l as show previosly to see your new partition name.
Suppose your new partition name is /dev/sda6 then we will go ahead with creating filesystem on it as shown below.
or you can use the below command also to make ext2 filesystem.
both the above command will give the same effect on the partition(this command will take some time to complete if your partition size is much higher)
Now you can mount the newly created partition wherever you want and start using the filesystem.
Now one of the main feature that is different in ext3 filesystem is the jounalling of the filesystem.
For understanding journing you can reffer this post
ext3 was introduced by Stephen Tweedie. some noteworthy points about ext3 filesystem are as follows.
Max file size: 16 GB to 2 TB
Max file system size: 2 TB to 32 TB
One more interesting fact is that if you want journalling mechanism to be in your ext2 filesystem then you can easily convert it to ext3.
Now lets understand how to create ext3 filesystem:
And as told before you can convert an ext2 filesystem without data loss by the following command.
Note: first unmount the file system, then run the below command
#tune2fs -j /dev/sda6