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
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?
From my current understanding, you need to use /dev/mapper/vg-lv for LUKS encryption (which is not a RHCSA/RHCE 7 topic any more). For the rest, you can use either /dev/mapper/vg-lv or /dev/vg/lv.
The first (/dev/vg/lv) is LVM1. The second (/dev/mapper/vg-lv) is LVM2. Either method can be used for LVM2.
Thanks for this information.