This is an old revision of the document!
Create Mount Unmount And Use Vfat Ext4 And Xfs File Systems
General Information
Creating different file systems.
Creation and Mounting
Create filesystem examples (vfat, ext4, xfs)
mkfs.vfat /dev/sdb1 mkfs.ext4 /dev/sdb2 mkfs.xfs /dev/sdb3 or mkfs -t vfat /dev/sdb1 mkfs -t ext4 /dev/sdb1 mkfs -t xfs /dev/sdb1
Mount (does not survive reboot)
mount /dev/sdb1 /mnt/dir1 mount /dev/sdb2 /mnt/dir2 mount /dev/sdb3 /mnt/dir3
Persistent Mounts (/etc/fstab)
vim /etc/fstab /dev/sdb1 /mnt/dir1 vfat defaults 1 2 /dev/sdb2 /mnt/dir2 ext4 defaults 1 2 /dev/sdb3 /mnt/dir3 xfs defaults 1 2
Unmount
umount /mnt/dir1 umount /mnt/dir2 umount /mnt/dir3
Maintenance
Details about ext2/3/4 filesystems
dumpe2fs /dev/sdb2
Label ext2/3/4 filesystem
tune2fs -L mylabel /dev/sdb2
Check/repair vfat and ext4 filesystem
fsck.vfat /dev/sdb1 fsck /dev/sdb2
- Filesystems must be unmounted for fsck to run
Display XFS filesystem information
xfs_info /dev/sdb3
Label XFS filesystem
xfs_admin -L mylabel /dev/sdb3
- Must be unmounted
Check/repair XFS filesystem
xfs_repair /dev/sdb3