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 (No Ratings Yet)
Loading...

Leave a Reply

2 Comments on "SYS: Create, mount, unmount, and use ext2, ext3, and ext4 file systems."

Notify of
Sort by:   newest | oldest
limweipin
Member
limweipin

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?

wpDiscuz

RHCSA7: Task of the day

Allowed time: 10 minutes.
Create an EXT4 file system mounted by UUID in /etc/fstab under /vol based on a logical volume of 28 logical extents.

RHCE7: Task of the day

Allowed time: 5 minutes.
Set up time synchronization with default configuration.

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 ...