1 00:00:00,000 --> 00:00:09,000 In this video, I'll tell you a bit about ButterFS. 2 00:00:09,000 --> 00:00:13,000 Btrfs is to be pronounced as ButterFS. 3 00:00:13,000 --> 00:00:16,000 And that is because butter comes from a cow. 4 00:00:16,000 --> 00:00:18,000 That's a joke by the main developer. 5 00:00:18,000 --> 00:00:20,000 Cow stands for copy-on-write, 6 00:00:20,000 --> 00:00:23,000 and copy-on-write is the strategy that is used 7 00:00:23,000 --> 00:00:27,000 to guarantee file integrity on ButterFS. 8 00:00:27,000 --> 00:00:30,000 ButterFS is also a B3 file system. 9 00:00:30,000 --> 00:00:34,000 B3 is the database that is used behind the file system 10 00:00:34,000 --> 00:00:37,000 for storing your files in the most efficient way. 11 00:00:37,000 --> 00:00:41,000 It offers advanced features such as volumes and copy-on-write. 12 00:00:41,000 --> 00:00:44,000 Copy-on-write means that if ever you are changing a file, 13 00:00:44,000 --> 00:00:49,000 before changing it, the original file is copied to another location, 14 00:00:49,000 --> 00:00:52,000 so during the change, something is going wrong, 15 00:00:52,000 --> 00:00:56,000 you can always easily revert to the original file. 16 00:00:56,000 --> 00:00:59,000 As I just mentioned, because butter comes from a cow, 17 00:00:59,000 --> 00:01:03,000 we call it ButterFS and not Btrfs or BetterFS, 18 00:01:03,000 --> 00:01:07,000 even if there's people that like calling it that way. 19 00:01:07,000 --> 00:01:11,000 Now, ButterFS is the default file system on Fedora Linux, 20 00:01:11,000 --> 00:01:14,000 and you will find it on some other Linux distributors as well, 21 00:01:14,000 --> 00:01:18,000 but not on the main distributors that we are using for this course, 22 00:01:18,000 --> 00:01:20,000 which are CentOS and Ubuntu. 23 00:01:20,000 --> 00:01:22,000 And for that reason, I'm not going to demonstrate, 24 00:01:22,000 --> 00:01:24,000 but on the Linux Plus exam, 25 00:01:24,000 --> 00:01:26,000 you need to know a little bit about it. 26 00:01:26,000 --> 00:01:28,000 So let's go through it. 27 00:01:28,000 --> 00:01:33,000 One of the reasons that ButterFS was created in the first place 28 00:01:33,000 --> 00:01:35,000 is because of ZFS. 29 00:01:35,000 --> 00:01:40,000 ZFS is a file system that comes from BSD Unix, 30 00:01:40,000 --> 00:01:42,000 and it provides flexible features, 31 00:01:42,000 --> 00:01:46,000 but this file system is a license that is not compatible 32 00:01:46,000 --> 00:01:48,000 with the Linux kernel license. 33 00:01:48,000 --> 00:01:52,000 And for that reason, you will never see ZFS ever supported 34 00:01:52,000 --> 00:01:56,000 in one of the main Linux distributions. 35 00:01:56,000 --> 00:02:00,000 And that is why ButterFS has been developed as an alternative. 36 00:02:00,000 --> 00:02:04,000 Another alternative for providing similar features is Stratis. 37 00:02:04,000 --> 00:02:07,000 Stratis is used on Red Hat environments, 38 00:02:07,000 --> 00:02:10,000 and Stratis is a volume manager that can be used 39 00:02:10,000 --> 00:02:13,000 below the XFS file system. 40 00:02:13,000 --> 00:02:15,000 So Stratis is not a file system. 41 00:02:15,000 --> 00:02:20,000 Stratis is the volume manager below the XFS file system. 42 00:02:20,000 --> 00:02:24,000 One of the features in ButterFS is the subvolume. 43 00:02:24,000 --> 00:02:28,000 A subvolume allows you to add properties to directories 44 00:02:28,000 --> 00:02:31,000 that you can normally only set on storage devices. 45 00:02:31,000 --> 00:02:34,000 So let's use noexec as an example. 46 00:02:34,000 --> 00:02:37,000 Noexec is a property that makes it you cannot run 47 00:02:37,000 --> 00:02:40,000 any executable files from a directory. 48 00:02:40,000 --> 00:02:43,000 If you want to use noexec on XFS, 49 00:02:43,000 --> 00:02:46,000 then you need to create an XFS file system. 50 00:02:46,000 --> 00:02:48,000 If you want to use noexec on ButterFS, 51 00:02:48,000 --> 00:02:51,000 you can just do it on a directory 52 00:02:51,000 --> 00:02:54,000 by making that directory a subvolume. 53 00:02:54,000 --> 00:02:56,000 ButterFS has different utilities, 54 00:02:56,000 --> 00:03:00,000 like ButterFS file system show and ButterFS file system label 55 00:03:00,000 --> 00:03:04,000 and ButterFS subvolume list or subvolume create. 56 00:03:04,000 --> 00:03:08,000 You can also use the ButterFS subvolume home option 57 00:03:08,000 --> 00:03:11,000 to the user add command on distributions 58 00:03:11,000 --> 00:03:13,000 that are supporting ButterFS. 59 00:03:13,000 --> 00:03:16,000 And that makes that a user is getting 60 00:03:16,000 --> 00:03:18,000 a ButterFS-based home directory. 61 00:03:18,000 --> 00:03:22,000 One of the interesting features in ButterFS is a snapshot. 62 00:03:22,000 --> 00:03:25,000 It comes with enabled snapshot functionality. 63 00:03:25,000 --> 00:03:27,000 And making a snapshot allows users 64 00:03:27,000 --> 00:03:29,000 to freeze the current state of files. 65 00:03:29,000 --> 00:03:32,000 And that is useful before performing tests. 66 00:03:32,000 --> 00:03:35,000 If desired, it is easy to revert to the previous state. 67 00:03:35,000 --> 00:03:38,000 Snapshots are created on a subvolume level, 68 00:03:38,000 --> 00:03:41,000 and the command to use is ButterFS subvolume snapshot 69 00:03:41,000 --> 00:03:43,000 followed by slash files, 70 00:03:43,000 --> 00:03:45,000 which is the name of your subvolume, 71 00:03:45,000 --> 00:03:47,000 and slash files slash snapshots, 72 00:03:47,000 --> 00:03:50,000 that will be the name of your snapshot. 73 00:03:50,000 --> 00:03:52,000 And to figure out if you have any snapshots, 74 00:03:52,000 --> 00:03:55,000 use ButterFS subvolume list. 75 00:03:55,000 --> 00:03:58,000 And once you want to revert to a snapshot, 76 00:03:58,000 --> 00:04:02,000 ButterFS subvolume set default 258 slash files 77 00:04:02,000 --> 00:04:04,000 allows you to set the snapshot ID 78 00:04:04,000 --> 00:04:07,000 as a new mount point for a directory. 79 00:04:07,000 --> 00:04:09,000 And then you will have immediately returned 80 00:04:09,000 --> 00:04:11,000 to the original state.