SYS: Create, mount, unmount, and use ext2, ext3, and ext4 file systems.

Share this link

To create an ext2, ext3, and ext4 file system (here called /dev/vg/lv_vol), type:

# mkfs.ext2 /dev/vg/lv_vol
# mkfs.ext3 /dev/vg/lv_vol
# mkfs.ext4 /dev/vg/lv_vol

To mount this file system, type:

# mount /dev/vg/lv_vol /mnt

To mount it permanently, edit the /etc/fstab file and add the following line:

/dev/vg/lv_vol /mnt ext4 defaults 1 2

To check an unmounted file system consistency, type:

# fsck /dev/vg/lv_vol

To convert a file system from ext2 to ext3, type:

# mount -o remount,ro /dev/vg/lv_vol
# tune2fs -j /dev/vg/lv_vol
# mount -o remount,rw /dev/vg/lv_vol

To convert back a file system from ext3 to ext2, type:

# umount /dev/vg/lv_vol
# /sbin/tune2fs -O ^has_journal /dev/vg/lv_vol
# /sbin/e2fsck -y /dev/vg/lv_vol
# mount -t ext2 /dev/vg/lv_vol /mnt
# cd /mnt
# rm -f .journal

To convert a unmounted file system from ext3 to ext4, type:

# tune2fs -O extent,uninit_bg,dir_index /dev/vg/lv_vol

To get details about a file system, type:

# dumpe2fs /dev/vg/lv_vol
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4.00 out of 5)
Loading...
4 comments on “SYS: Create, mount, unmount, and use ext2, ext3, and ext4 file systems.
  1. limweipin says:

    hi, I am having confusion in between /dev/mapper/vg-lv and /dev/vg/lv. When should we use /dev/mapper/vg-lv? Is it when there is lv create we use /dev/mapper/vg-lv while if it is a partition we use /dev/sda1? And i also see LUKS encryption is using /dev/mapper/vol too?

Leave a Reply

Upcoming Events (Local Time)

There are no events.

RHCSA7: Task of the day

Allowed time: 8 minutes.
Find all files bigger than 100MB and write their names into the /root/results.txt file.

RHCE7: Task of the day

Allowed time: 10 minutes.
Change the SSH process configuration to only listen on the 443 port.

Follow me on Twitter

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...