Introduction
Linux is a widely used open source operating system. It supports many different types of file systems. Each filesystem has its own advantages and limitations.
ext4
The most commonly used file system on Linux is the ext4 (fourth extended file system). It is the successor of ext3 and is the most stable file system available. It supports up to 16 TiB of storage, has improved performance, and supports extended attributes.
xfs
Another most commonly used filesystem on Linux is XFS, XFS supports metadata journaling, quick crash recovery, defragmented and enlarged while mounted
XFS features Extent-based allocation, Stripe-aware allocation policies, Delayed allocation and Space pre-allocation
Btrfs
Btrfs (B-tree file system) is a newer file system that is gaining popularity. It is designed for scalability and supports features such as snapshotting, checksums, and data deduplication.
The limitation of ext4 is that it does not support advanced features such as snapshotting and data deduplication. XFS and Btrfs both support these features
Aufs
Aufs (Another Union File System) is a layered filesystem that allows multiple file systems to be merged together in a single hierarchy. It is used for virtualization and for creating container images. It has a limited feature set and is not as widely used as other filesystems.
NFS
NFS (Network File System) is a distributed filesystem that allows users to access files stored on remote computers. It is used for sharing files/folders over a network, but it has limited support for file locking and security.
ReiserFS
ReiserFS is an older file system that is no longer supported by most distributions. It is designed for fast file access and is used in embedded systems.
No the other-hand which file system we use, it is important to understand its advantages and limitations. Each file system has its own advantages /disadvantages, so it is important to choose the right one for your needs.
Linux filesystem repairs
Linux filesystems can be repaired with different command line tools. Depending on the filesystem type and size of the filesystem, the exact steps will vary, but the following instructions provide a general guideline for repairing a damaged Linux filesystem.
- Run a fsck (file system consistency check) command. This command will scan the filesystem and fix any issues it finds. It will also identify any problems with the filesystem structure, such as missing or corrupt inodes, bad blocks, or invalid file system metadata.
- Run a badblocks command if the fsck command did not solve the issue. This command will scan the filesystem for any bad blocks and mark them as bad.
- If the filesystem is still damaged, you may need to use a recovery tool to restore the data. Popular recovery tools include TestDisk, NTFS Undelete.
- If the filesystem is still not working properly, you may need to mount the filesystem in read-only mode. This will allow you to access the data on the filesystem without making any changes to it.
- After the filesystem is mounted in read-only mode, you can use a data recovery tool to attempt to restore any lost or corrupted
- Once the filesystem is repaired and the data is successfully recovered, you should then be able to remount the filesystem in read-write mode and use it normally.
Linux filesystem repair with examples
The below commands are used to check and repair the linux filesystem
fsck
The fsck command (short for file system consistency check) is used to check and repair filesystems (ext2, ext3, ext4, etc.)
sudo fsck /dev/device
e2fsck
e2fsck command (short for ext2/ext3/ext4 file system consistency check) is used to check and repair Linux ext2, ext3, and ext4 filesystems.
sudo e2fsck /dev/device
dumpe2fs
dumpe2fs command is used to display the superblock and block group information for the specified Linux ext2, ext3, or ext4 filesystem.
sudo dumpe2fs /dev/device
debugfs
debugfs command is used to view and modify the contents of an ext2, ext3, or ext4 filesystem.
sudo debugfs -w /dev/device
mke2fs
mke2fs command is used to create a Linux ext2, ext3, or ext4 filesystem.
sudo mke2fs -j /dev/device
xfs_repair
xfs_repair
utility is highly scalable and it even very large file systems, Unlike other Linux file systems, xfs_repair
does not run at boot time, even when an XFS file system was not cleanly unmounted
xfs_repair /dev/device
Conclusion
Hope you will get some info on filesystem usage / limitations, in coming posts we will see usage o each filesystem
Also Read – LVM – How to extend a partition using Logical Volume Manager https://computercarriage.com/2020/05/12/lvm-howto/
External Site – https://linux.die.net/man/8/xfs_repair