Linux 101 : The "ext4" filesystem



The ext4 filesystem:

An ext4 is a Linux filesystem can have files that are up to 16TB in size.

Creating an ext4 filesystem:

We could use the below command to create an"ext4" filesystem on our "/dev/sda3" partition:


We could also set the UUID for a device when creating an ext4 filesystem. 

A UUID is a fixed identifier that doesn't change, for example, when we add disks to a system.

Partition names could change when adding a new disk to the system, causing errors.

We set the UUID for our partition using the below command:


We could use the below UUID for example:

"4gh67fg4-e0dc-41d9-g78u-23n454l6ldf4".

We could then mount our filesystem using the below command:


Resizing our partition:

We can resize a filesystem to the wanted size, using the below command:


The size could be for example in: 
  • M : megabytes
  • G : gigabytes
For example, we could have "200M".

Remark:

To reduce the size of a filesystem, the device needs to be unmounted.

Backing up our partition:

To back up our partition to a file, we use the "dump" utility as below:


Restoring our partition:

We start by creating a partition using "fdisk" for example, then we create a filesystem on it using the below command:


We relabel our partition, so that it matches the label of the old partition using the below command:


We mount it, and proceed with the restoration process as shown below:


Comments

Leave as a comment:

Archive