{"id":273,"date":"2016-02-25T16:36:22","date_gmt":"2016-02-25T21:36:22","guid":{"rendered":"http:\/\/underhost.com\/blog\/?p=273"},"modified":"2026-10-23T09:51:27","modified_gmt":"2026-10-23T13:51:27","slug":"how-to-fsck-a-linux-filesystem","status":"publish","type":"post","link":"https:\/\/underhost.com\/blog\/how-to-fsck-a-linux-filesystem\/","title":{"rendered":"How to Check and Repair a Linux Filesystem (fsck for ext4, xfs_repair for XFS)"},"content":{"rendered":"<div class=\"uh-blog-hero\" style=\"margin:0 0 40px;text-align:center;padding:48px 24px;border-radius:20px;background:linear-gradient(135deg,#0D1F3C 0%,#125A8A 58%,#176EA5 100%);color:#ffffff;box-shadow:0 20px 40px -15px rgba(13,31,60,0.28);position:relative;overflow:hidden;\">\n<div style=\"display:inline-flex;align-items:center;gap:8px;padding:7px 14px;margin-bottom:16px;border:1px solid rgba(0,212,255,0.32);border-radius:999px;color:#DFF8FF;font-size:12px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;background:rgba(0,212,255,0.10);\"><i class=\"fas fa-terminal\" style=\"color:#00D4FF;\"><\/i> Linux<\/div>\n<h1 style=\"color:#ffffff;font-size:clamp(32px,5vw,46px);line-height:1.12;margin:0 0 14px;font-weight:800;\">How to Check and Repair a Linux Filesystem (fsck for ext4, xfs_repair for XFS)<\/h1>\n<\/div>\n<div style=\"background:#FFF7ED;border:1px solid #FDBA74;border-radius:16px;padding:20px 22px;margin:24px 0;\">\n<h3 style=\"margin:0 0 10px;color:#9A3412;font-size:20px;\"><i class=\"fas fa-exclamation-triangle\" style=\"color:#F97316;\"><\/i> Safety first:<\/h3>\n<p style=\"margin:0;color:#7C2D12;line-height:1.7;\">Never repair a mounted filesystem, because it can destroy data. Take a backup or snapshot first, and always run a read-only check before you repair anything.<\/p>\n<\/div>\n<div class=\"uh-blog-excerpt\" style=\"border-left:4px solid #00D4FF;padding:18px 20px;margin:0 0 34px;background:#F8FAFC;color:#1F2937;border-radius:0 14px 14px 0;box-shadow:0 8px 28px rgba(13,31,60,0.08);line-height:1.75;\"><strong style=\"color:#0D1F3C;\">Short answer:<\/strong> Find the device and its filesystem type with <code>lsblk -f<\/code>. For <strong>ext4<\/strong>, unmount it and run <code>fsck -n \/dev\/DEVICE<\/code> to check, then <code>fsck -y \/dev\/DEVICE<\/code> to repair. For <strong>XFS<\/strong>, the default on AlmaLinux and Rocky Linux, use <code>xfs_repair -n<\/code> and <code>xfs_repair<\/code> instead, because fsck does nothing on XFS. The root filesystem cannot be unmounted, so repair it from rescue mode or force a check at the next boot.<\/div>\n<nav aria-label=\"Table of contents\" class=\"uh-toc\" style=\"background:#ffffff;border:1px solid #E5E7EB;border-radius:16px;padding:20px 22px;margin:0 0 34px;box-shadow:0 4px 12px rgba(13,31,60,0.08);\">\n<div style=\"font-size:12px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:#176EA5;margin-bottom:10px;\"><i class=\"fas fa-list\" style=\"color:#00D4FF;\"><\/i> In this guide<\/div>\n<ol style=\"margin:0;padding-left:20px;columns:2 260px;column-gap:28px;line-height:1.9;\">\n<li><a href=\"#signs-of-filesystem-problems\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">Signs of filesystem problems<\/a><\/li>\n<li><a href=\"#step-1-find-the-device-and-filesystem-type\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">Step 1: find the device and filesystem type<\/a><\/li>\n<li><a href=\"#step-2-back-up-first\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">Step 2: back up first<\/a><\/li>\n<li><a href=\"#step-3-check-and-repair-a-data-partition\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">Step 3: check and repair a data partition<\/a><\/li>\n<li><a href=\"#step-4-the-root-filesystem\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">Step 4: the root filesystem<\/a><\/li>\n<li><a href=\"#read-the-fsck-result\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">Read the fsck result<\/a><\/li>\n<li><a href=\"#when-the-disk-itself-is-failing\" style=\"color:#176EA5;text-decoration:none;font-weight:600;\">When the disk itself is failing<\/a><\/li>\n<\/ol>\n<\/nav>\n<div class=\"uh-post-content\" style=\"color:#1F2937;font-size:16px;line-height:1.75;\">\n<h2 id=\"signs-of-filesystem-problems\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-exclamation-triangle\" style=\"color:#00D4FF;\"><\/i> Signs of filesystem problems<\/h2>\n<ul style=\"margin:0 0 24px;padding-left:22px;\">\n<li style=\"margin:0 0 8px;\">Errors such as <em>Read-only file system<\/em> when you save files: the kernel switched the disk to read-only to protect it.<\/li>\n<li style=\"margin:0 0 8px;\">Messages about ext4 or XFS errors in <code>dmesg<\/code> or the system journal.<\/li>\n<li style=\"margin:0 0 8px;\">Files or folders that cannot be opened, or show question marks in <code>ls -l<\/code>.<\/li>\n<li style=\"margin:0 0 8px;\">The server stops at boot and asks you to run fsck manually.<\/li>\n<\/ul>\n<pre style=\"background:#0D1F3C;color:#EAF6FF;padding:18px 20px;border-radius:14px;overflow-x:auto;line-height:1.7;font-size:15px;\"><code>dmesg -T | grep -iE \"ext4|xfs|i\/o error\" | tail -n 20\njournalctl -k -p err -b --no-pager | tail -n 20<\/code><\/pre>\n<h2 id=\"step-1-find-the-device-and-filesystem-type\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-terminal\" style=\"color:#00D4FF;\"><\/i> Step 1: find the device and filesystem type<\/h2>\n<pre style=\"background:#0D1F3C;color:#EAF6FF;padding:18px 20px;border-radius:14px;overflow-x:auto;line-height:1.7;font-size:15px;\"><code>lsblk -f          # devices, filesystem types and mount points\ndf -hT            # mounted filesystems with their types<\/code><\/pre>\n<p style=\"margin:0 0 18px;\">Note the device for the problem partition, for example <code>\/dev\/sda3<\/code>, <code>\/dev\/vda1<\/code> or an LVM volume such as <code>\/dev\/mapper\/almalinux-home<\/code>, and its type.<\/p>\n<div style=\"overflow-x:auto;margin:26px 0;border:1px solid #E5E7EB;border-radius:14px;-webkit-overflow-scrolling:touch;\">\n<table style=\"width:100%;border-collapse:collapse;background:#ffffff;color:#1F2937;font-size:15px;line-height:1.55;margin:0;min-width:600px;\">\n<thead>\n<tr style=\"background:#0D1F3C;color:#fff;\">\n<th style=\"padding:14px;text-align:left;\">Filesystem<\/th>\n<th style=\"padding:14px;text-align:left;\">Check and repair tool<\/th>\n<th style=\"padding:14px;text-align:left;\">Common on<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">ext4<\/td>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\"><code>fsck<\/code> (runs e2fsck)<\/td>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">Debian, Ubuntu, many VPS images<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">XFS<\/td>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\"><code>xfs_repair<\/code><\/td>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">AlmaLinux, Rocky Linux, RHEL, CloudLinux<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2 id=\"step-2-back-up-first\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-terminal\" style=\"color:#00D4FF;\"><\/i> Step 2: back up first<\/h2>\n<p style=\"margin:0 0 18px;\">A repair can delete damaged files or move them to <code>lost+found<\/code>. Copy important data off the server, or take a snapshot, before you continue. See our <a href=\"https:\/\/underhost.com\/blog\/the-importance-of-regular-backups-for-your-website\/\">backups guide<\/a>.<\/p>\n<h2 id=\"step-3-check-and-repair-a-data-partition\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-terminal\" style=\"color:#00D4FF;\"><\/i> Step 3: check and repair a data partition<\/h2>\n<p style=\"margin:0 0 18px;\">For a partition other than <code>\/<\/code>, such as <code>\/home<\/code> or an extra disk, stop the services that use it, then unmount it:<\/p>\n<pre style=\"background:#0D1F3C;color:#EAF6FF;padding:18px 20px;border-radius:14px;overflow-x:auto;line-height:1.7;font-size:15px;\"><code># Find what is using the partition\nlsof +f -- \/home | head\n\n# Unmount it\numount \/home<\/code><\/pre>\n<h3 style=\"color:#0D1F3C;font-size:21px;line-height:1.3;margin:26px 0 10px;\">ext4<\/h3>\n<pre style=\"background:#0D1F3C;color:#EAF6FF;padding:18px 20px;border-radius:14px;overflow-x:auto;line-height:1.7;font-size:15px;\"><code>fsck -n \/dev\/sda3     # check only, no changes\nfsck -y \/dev\/sda3     # repair, answering yes to every fix<\/code><\/pre>\n<h3 style=\"color:#0D1F3C;font-size:21px;line-height:1.3;margin:26px 0 10px;\">XFS<\/h3>\n<pre style=\"background:#0D1F3C;color:#EAF6FF;padding:18px 20px;border-radius:14px;overflow-x:auto;line-height:1.7;font-size:15px;\"><code>xfs_repair -n \/dev\/sda3     # check only, no changes\nxfs_repair \/dev\/sda3        # repair<\/code><\/pre>\n<p style=\"margin:0 0 18px;\">If xfs_repair says the log must be replayed, mount and unmount the filesystem once, then run it again. Use the <code>-L<\/code> option only as a last resort, because it discards the log and can lose recent changes.<\/p>\n<p style=\"margin:0 0 18px;\">Mount the partition again with <code>mount \/home<\/code> and check your data.<\/p>\n<h2 id=\"step-4-the-root-filesystem\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-terminal\" style=\"color:#00D4FF;\"><\/i> Step 4: the root filesystem<\/h2>\n<p style=\"margin:0 0 18px;\">You cannot unmount <code>\/<\/code> while the server runs from it. You have two options:<\/p>\n<ul style=\"margin:0 0 24px;padding-left:22px;\">\n<li style=\"margin:0 0 8px;\"><strong>Rescue mode:<\/strong> boot the server into your provider&#8217;s rescue system, then run the check on the root device, which is not mounted there. This works for both ext4 and XFS.<\/li>\n<li style=\"margin:0 0 8px;\"><strong>Check at next boot (ext4):<\/strong> add <code>fsck.mode=force fsck.repair=yes<\/code> to the kernel command line for one boot, then remove it again.<\/li>\n<\/ul>\n<pre style=\"background:#0D1F3C;color:#EAF6FF;padding:18px 20px;border-radius:14px;overflow-x:auto;line-height:1.7;font-size:15px;\"><code># AlmaLinux and Rocky Linux: force a check at the next boot, then reboot\ngrubby --update-kernel=ALL --args=\"fsck.mode=force fsck.repair=yes\"\nreboot\n\n# After the server is back, remove the option again\ngrubby --update-kernel=ALL --remove-args=\"fsck.mode=force fsck.repair=yes\"<\/code><\/pre>\n<p style=\"margin:0 0 18px;\">Have console access ready in case the check needs your input. XFS is checked by xfs_repair from rescue mode, not at boot.<\/p>\n<h2 id=\"read-the-fsck-result\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-angle-double-right\" style=\"color:#00D4FF;\"><\/i> Read the fsck result<\/h2>\n<div style=\"overflow-x:auto;margin:26px 0;border:1px solid #E5E7EB;border-radius:14px;-webkit-overflow-scrolling:touch;\">\n<table style=\"width:100%;border-collapse:collapse;background:#ffffff;color:#1F2937;font-size:15px;line-height:1.55;margin:0;\">\n<thead>\n<tr style=\"background:#0D1F3C;color:#fff;\">\n<th style=\"padding:14px;text-align:left;\">Exit code<\/th>\n<th style=\"padding:14px;text-align:left;\">Meaning<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">0<\/td>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">No errors found<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">1<\/td>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">Errors were found and corrected<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">2<\/td>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">Errors corrected; the system should be rebooted<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">4<\/td>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">Errors left uncorrected<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">8<\/td>\n<td style=\"padding:14px;border-top:1px solid #E5E7EB;vertical-align:top;\">Operational error, for example a wrong device name<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p style=\"margin:0 0 18px;\">Check the code with <code>echo $?<\/code> right after fsck. Files fsck could not place are moved to <code>lost+found<\/code> on that filesystem.<\/p>\n<h2 id=\"when-the-disk-itself-is-failing\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-info-circle\" style=\"color:#00D4FF;\"><\/i> When the disk itself is failing<\/h2>\n<p style=\"margin:0 0 18px;\">Repeated errors can mean the disk is failing, not just the filesystem. On a dedicated server, check the disk health:<\/p>\n<pre style=\"background:#0D1F3C;color:#EAF6FF;padding:18px 20px;border-radius:14px;overflow-x:auto;line-height:1.7;font-size:15px;\"><code>smartctl -H \/dev\/sda\nsmartctl -a \/dev\/sda | grep -iE \"reallocated|pending|uncorrectable\"<\/code><\/pre>\n<p style=\"margin:0 0 18px;\">If the disk reports problems, copy your data off at once and contact support to replace it. On a VPS, the disk is virtual, so report repeated I\/O errors to support.<\/p>\n<div aria-hidden=\"true\" class=\"uh-section-divider\" style=\"width:min(100% - 32px, 1080px);margin:44px auto;display:grid;grid-template-columns:1fr 32px 1fr;align-items:center;gap:18px;pointer-events:none;\"><span style=\"height:1px;background:linear-gradient(90deg,transparent,rgba(0,212,255,0.40),rgba(23,110,165,0.24),transparent);\"><\/span><img alt=\"\" decoding=\"async\" height=\"32\" loading=\"lazy\" src=\"https:\/\/cdn.underhost.com\/android-chrome-192x192.webp\" style=\"width:32px;height:32px;display:block;border-radius:8px;filter:drop-shadow(0 0 14px rgba(0,212,255,0.30));\" width=\"32\"\/><span style=\"height:1px;background:linear-gradient(90deg,transparent,rgba(23,110,165,0.24),rgba(0,212,255,0.40),transparent);\"><\/span><\/div>\n<\/div>\n<div class=\"uh-blog-cta\" style=\"background:linear-gradient(135deg,#0D1F3C 0%,#125A8A 58%,#176EA5 100%);color:#ffffff;padding:36px 24px;border-radius:20px;text-align:center;margin:44px 0;box-shadow:0 20px 40px -15px rgba(13,31,60,0.32);\">\n<h2 style=\"margin:0 0 12px;font-size:28px;line-height:1.25;color:#ffffff;\">Need help with this?<\/h2>\n<p style=\"font-size:17px;margin:0 auto 22px;color:#EAF6FF;max-width:720px;line-height:1.7;\">Disk or filesystem trouble on your server? Our team can check and repair it safely from rescue mode.<\/p>\n<p><a href=\"https:\/\/underhost.com\/server-management.php\" style=\"background:linear-gradient(90deg,#00D4FF,#0077FF);color:#ffffff;padding:13px 28px;border-radius:10px;text-decoration:none;font-weight:800;display:inline-block;margin:8px;\">See server management plans<\/a><a href=\"https:\/\/customerpanel.ca\/client\/\" style=\"background:transparent;color:#ffffff;padding:12px 28px;border-radius:10px;text-decoration:none;font-weight:800;display:inline-block;margin:8px;border:1px solid rgba(255,255,255,0.32);\">Contact @CustomerPanel<\/a><\/div>\n<div class=\"uh-faq-section\" id=\"faq\" style=\"margin:34px 0;scroll-margin-top:90px;\">\n<h2 style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:0 0 18px;border-bottom:2px solid rgba(0,212,255,0.22);padding-bottom:10px;\">Frequently asked questions<\/h2>\n<div style=\"margin-top:18px;background:#F8FAFC;padding:18px 20px;border-radius:14px;border:1px solid rgba(23,110,165,0.14);\">\n<h3 style=\"color:#0D1F3C;margin:0 0 8px;font-size:19px;\">Can I run fsck on a mounted filesystem?<\/h3>\n<p style=\"margin:0;color:#1F2937;line-height:1.7;\">No. It can corrupt data. Unmount the filesystem first, or use rescue mode for the root filesystem.<\/p>\n<\/div>\n<div style=\"margin-top:18px;background:#F8FAFC;padding:18px 20px;border-radius:14px;border:1px solid rgba(23,110,165,0.14);\">\n<h3 style=\"color:#0D1F3C;margin:0 0 8px;font-size:19px;\">Why does fsck do nothing on AlmaLinux?<\/h3>\n<p style=\"margin:0;color:#1F2937;line-height:1.7;\">AlmaLinux uses XFS by default, and fsck does not check XFS. Use xfs_repair instead.<\/p>\n<\/div>\n<div style=\"margin-top:18px;background:#F8FAFC;padding:18px 20px;border-radius:14px;border:1px solid rgba(23,110,165,0.14);\">\n<h3 style=\"color:#0D1F3C;margin:0 0 8px;font-size:19px;\">How do I check the root filesystem?<\/h3>\n<p style=\"margin:0;color:#1F2937;line-height:1.7;\">Boot into rescue mode and check the unmounted device, or force a check at the next boot on ext4.<\/p>\n<\/div>\n<div style=\"margin-top:18px;background:#F8FAFC;padding:18px 20px;border-radius:14px;border:1px solid rgba(23,110,165,0.14);\">\n<h3 style=\"color:#0D1F3C;margin:0 0 8px;font-size:19px;\">What is the lost+found folder?<\/h3>\n<p style=\"margin:0;color:#1F2937;line-height:1.7;\">It holds files that fsck recovered but could not put back in their original folder.<\/p>\n<\/div>\n<div style=\"margin-top:18px;background:#F8FAFC;padding:18px 20px;border-radius:14px;border:1px solid rgba(23,110,165,0.14);\">\n<h3 style=\"color:#0D1F3C;margin:0 0 8px;font-size:19px;\">Is it safe to answer yes to every fix?<\/h3>\n<p style=\"margin:0;color:#1F2937;line-height:1.7;\">Usually, after a read-only check and a backup. Without a backup, a repair can still remove damaged files.<\/p>\n<\/div>\n<\/div>\n<p><!-- uh-related-start --><\/p>\n<div style=\"background:#F4F8FC;border:1px solid #DCE7F3;border-radius:14px;padding:18px 22px;margin:32px 0 8px;\">\n<h2 style=\"margin:0 0 12px;font-size:22px;\">Related guides<\/h2>\n<ul style=\"margin:0;padding-left:20px;\">\n<li style=\"margin:0 0 8px;\"><a href=\"https:\/\/underhost.com\/blog\/how-to-install-rkhunter-on-linux-rootkit-hunter\/\">How to Install RKHunter on Linux (RootKit Hunter) in RHEL, CentOS and Fedora<\/a><\/li>\n<li style=\"margin:0 0 8px;\"><a href=\"https:\/\/underhost.com\/blog\/cve-2026-31431-copy-fail-linux-server-patch-guide\/\">CVE-2026-31431 \u2018Copy Fail\u2019: Why Linux Server Owners Should Patch Now<\/a><\/li>\n<li style=\"margin:0 0 8px;\"><a href=\"https:\/\/underhost.com\/blog\/real-time-linux-server-monitoring-tools-setup-enterprise-solutions-for-sysadmins\/\">Real-Time Linux Server Monitoring: Tools, Setup &amp; Enterprise Solutions for Sysadmins<\/a><\/li>\n<li style=\"margin:0 0 8px;\"><a href=\"https:\/\/underhost.com\/blog\/how-to-install-linux-malware-detect\/\">How to Install Linux Malware Detect (LMD)<\/a><\/li>\n<li style=\"margin:0 0 8px;\"><a href=\"https:\/\/underhost.com\/blog\/common-ssh-commands-or-linux-shell-commands-old-version\/\">Updated MARCH 2025: Essential SSH Commands for Linux Server Management<\/a><\/li>\n<\/ul>\n<\/div>\n<p><!-- uh-related-end --><br \/>\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"Can I run fsck on a mounted filesystem?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. It can corrupt data. Unmount the filesystem first, or use rescue mode for the root filesystem.\"}}, {\"@type\": \"Question\", \"name\": \"Why does fsck do nothing on AlmaLinux?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"AlmaLinux uses XFS by default, and fsck does not check XFS. Use xfs_repair instead.\"}}, {\"@type\": \"Question\", \"name\": \"How do I check the root filesystem?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Boot into rescue mode and check the unmounted device, or force a check at the next boot on ext4.\"}}, {\"@type\": \"Question\", \"name\": \"What is the lost+found folder?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"It holds files that fsck recovered but could not put back in their original folder.\"}}, {\"@type\": \"Question\", \"name\": \"Is it safe to answer yes to every fix?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Usually, after a read-only check and a backup. Without a backup, a repair can still remove damaged files.\"}}]}<\/script><\/p>\n<h2 id=\"sources\" style=\"color:#0D1F3C;font-size:28px;line-height:1.25;margin:34px 0 14px;scroll-margin-top:90px;\"><i class=\"fas fa-book\" style=\"color:#00D4FF;\"><\/i> Sources<\/h2>\n<ul style=\"margin:0 0 24px;padding-left:22px;\">\n<li style=\"margin:0 0 8px;\"><a href=\"https:\/\/man7.org\/linux\/man-pages\/man8\/e2fsck.8.html\">e2fsck manual page<\/a><\/li>\n<li style=\"margin:0 0 8px;\"><a href=\"https:\/\/man7.org\/linux\/man-pages\/man8\/xfs_repair.8.html\">xfs_repair manual page<\/a><\/li>\n<li style=\"margin:0 0 8px;\"><a href=\"https:\/\/www.freedesktop.org\/software\/systemd\/man\/latest\/systemd-fsck@.service.html\">systemd-fsck manual page<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Find the device and its filesystem type with lsblk -f. For ext4, unmount it and run fsck -n \/dev\/DEVICE to check, then fsck -y \/dev\/DEVICE to repair. For XFS, the default on AlmaLinux and Rocky Linux, use xfs_repair -n and xfs_repair instead, because fsck does nothing on XFS. The root filesystem cannot be unmounted, so repair it from rescue mode or force a check at the next boot.<\/p>\n","protected":false},"author":1,"featured_media":311,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[111,125,115],"class_list":["post-273","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-tag-almalinux","tag-tag-backups","tag-tag-linux-server"],"_links":{"self":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts\/273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/comments?post=273"}],"version-history":[{"count":8,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts\/273\/revisions"}],"predecessor-version":[{"id":7012,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts\/273\/revisions\/7012"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/media\/311"}],"wp:attachment":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/media?parent=273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/categories?post=273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/tags?post=273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}