1 00:00:00,000 --> 00:00:11,600 In this video, we'll talk about options to repair file systems. Actually, you need to 2 00:00:11,600 --> 00:00:16,320 understand what is going on. And that is because many problems are fixed automatically when 3 00:00:16,320 --> 00:00:24,160 you boot because file system journal on XFS or the transaction log on XFS. This journal 4 00:00:24,160 --> 00:00:29,360 and transaction log mean that file systems basically are auto healing. So when you are 5 00:00:29,360 --> 00:00:34,320 booting and an error was encountered, the file system will do a rollback of the previous 6 00:00:34,320 --> 00:00:40,560 situation and you'll be all set. EXT file systems can be checked manually as well using 7 00:00:40,560 --> 00:00:46,320 the FS check utility, which is the utility that you can also use to repair. And on some 8 00:00:46,320 --> 00:00:52,240 more cases, you might need to have to do that. On XFS, it's even more rare with the XFS repair 9 00:00:52,240 --> 00:00:58,240 utility is available. If you are going to use these utilities, you need to make sure 10 00:00:58,240 --> 00:01:04,720 that you are in emergency mode because normally these utilities require the file system not to 11 00:01:04,720 --> 00:01:12,639 be opened at all. So let me show you how you can start these utilities. Starting here. 12 00:01:13,360 --> 00:01:20,160 So to start it, I need to reboot and get access to the group boot prompt. Getting access to the 13 00:01:20,160 --> 00:01:24,239 group boot prompt is always a little bit of a guess. You need to press escape at the right 14 00:01:24,239 --> 00:01:30,400 moment. And as you can see, I just succeeded. So here we see the default kernel that my system 15 00:01:30,400 --> 00:01:35,120 wants to start. I'm pressing E for edit. And then I'm looking up the line that starts with Linux 16 00:01:35,120 --> 00:01:42,800 and ends with R-H-Z-B and quiet, which is default on CentOS. I'm giving it the option init is 17 00:01:42,800 --> 00:01:49,120 slash bin slash bash. Init is bin bash is the most minimal troubleshooting mode. And the nice 18 00:01:49,120 --> 00:01:53,760 thing about this minimal troubleshooting mode is that your file systems are not yet 19 00:01:53,760 --> 00:01:59,919 mounted in a rewritable way. And also, you are not required to enter a root password. You just 20 00:01:59,919 --> 00:02:07,440 get access to a root shell. Now there, I'm going to use LSBLK, where I can see my block devices, 21 00:02:07,440 --> 00:02:12,720 and none of these block devices is mounted. So I need to use the appropriate utility. 22 00:02:12,720 --> 00:02:20,160 And in order to do so, I am going to use slash user slash sbin, where all of my XFS 23 00:02:20,160 --> 00:02:28,559 utilities are. And there we can see there is the XFS repair utility. So let's do that on dev sda1, 24 00:02:28,559 --> 00:02:35,119 which should be by my boot device. And oh boy, there I can see that XFS repair is failing. 25 00:02:35,839 --> 00:02:42,160 Bad primary superblock. And why is it giving me bad primary superblock? Well, that is because I 26 00:02:42,160 --> 00:02:49,520 made a mistake. And we did it on a VFAT file system. In order to use XFS repair and other 27 00:02:49,520 --> 00:02:54,639 repair utilities, they are file system specific. So you need to be on the right file system.