In this video, Kevin Dankwardt discusses a wide variety of special features for mounting and formatting ext4, XFS, and Btrfs file systems. He demonstrates making and mounting ext4 file systems with special options.
- [Instructor] Linux has lots of file systems and the file systems have different features and options, and flags you can give when you mount or when you format. So you really should check out the documentation like the man pages. There's overall information about file systems in section five, man five file systems. Ext4, which covers both ext2, ext3, and ext4. The previous ones as well.
Xfs and Btrfs, and notice it's section five in the manual. It just says man btrfs you might get the wrong one. The btrfs in section eight is some commands. Btrfs in section five is about the btrfs file system, mount options, and so forth. One way file systems can differ is in performance. So there's lots of benchmarks you can look at to see. And it might be a different choice depending on your circumstance.
Like how big your files are and so forth. So ext2, 3, and 4 have been around a long time and have a great reputation for reliability. And of course the newer ones, like 3 and 4 newer than 2 and so forth, have not only new features, but generally supported bigger files and bigger file systems. And for each kind of file system, there's a version of mkfs, mkfs.ext4, and mkfs.xfs and so forth.
Or you can just say mkfs-t in a type. So sometimes the man pages are the best place to look for mkfs stuff, because you can look at mkfs.ext4 as a man page. And, you know, there's various options when you make, like setting a block size or cluster size or so forth. There's a wiki in the kernel for ext4 if you want to keep up with what's going on there. Xfs has been around a long time, and has gotten to the point in Linux that it's now what red hat uses for its default.
So again, there's a bunch of options like barriers, having to do with whether it continues operations, that is, whether it has to wait for an operation to complete before it does another thing. The size of inode numbers is kind of big deal for the different file systems. Because if you use the larger inode numbers, then you count mount on an older kernel, for example.
And the file system may check to see if it's already mounted, so it doesn't let you mount it again. That can be good to prevent concurrent access inadvertently. But sometimes it's kind of handy to have it mounted more than once, maybe mounted with different options. Btrfs is an active project. Red hat is considering it not ready for prime time. And in fact, if you look at the wiki, btrfs.wiki.kernel.org, you'll see that there's still some issues, in particular with the RAID features.
But you can try out the RAID. But contrary to what you might want to use RAID for, the btrfs RAID might be unreliable. That means you might lose all your data. But if you use RAID for performance, and you back it up well, then you know, maybe that's okay. So let's look at some options for mkfs and mounting for ext4, xfs, and btrfs.
Alright, let's look at ext4. So let's make a file system. And there's an option, and if you repeat it twice, it checks for bad blocks, both reading and writing. With one c, it'll do some read tests. With two c's, it'll do some read and write tests. So we'll make sure that the blocks are fine. So let's try that. And then there's another interesting option: root_owner.
Maybe you never thought about that. But when you make a file system, the top directory needs to be owned by somebody, you usually think root. But you can set it to be somebody else. So root is zero, who's user ID one? Well, we can find out. So there's the extra options, so what are we going to format? Let's do disc d, partition one. Well, let's not do it while it's mounted.
Nice of it to tell us it was mounted. There we go. And then maybe you saw that it actually did some test. So it's not a real big thing, so it went pretty fast. Well, that looks good. Now let's try mounting that. Where should we mount it? Make a directory and we'll mount. What kind of interesting options, we can use the debug option and we can set the maximum directory size.
The issue with large directories is the kernel might want to read the whole directory in. We don't mean the contents of the directory, all the files in it. We mean the directory file itself. The directory file is what lists all the names of things. So if you have a directory with lots and lots of names, the directory file could be pretty big. And if that's all in memory and you have a small system, it can be an issue. So you can actually limit how big that could be and how much space it's going to take up.
Kind of obscure, but sometimes options for things are obscure for special cases that turn out to be important for some situations. So we formatted d1, so that's the one we should be able to mount. And there we go. There was no debug in output, and no real special output there. Alright, so that worked okay.
- Partitioning storage
- Creating, mounting, and unmounting file systems
- Formatting file systems
- Making volumes with LVM
- Adding storage security
- Managing swap spaces
- Backing up and recovering Linux storage systems
- Working with networked file systems like NFS and SSHFS