> For the complete documentation index, see [llms.txt](https://chunhthanhde.gitbook.io/google-learning-programs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chunhthanhde.gitbook.io/google-learning-programs/google-it-support-professional-certificate/course-3-operating-systems-and-becoming-a-power-user/module-4-filesystems/1.filesystem-types/12.window-linux-filesystem-repair.md).

# Windows Filesystem Repair 🛠️

### **Importance of Proper Ejection**

* **Why Eject?**: Properly ejecting or unmounting a USB drive ensures all data has been written from the buffer to the drive. Removing the drive too soon can cause data corruption. 📉
* **Buffer Role**: Data is first copied to a buffer (a region of RAM) before being written to the disk. If the buffer is not flushed properly, data may be lost or corrupted. 🗂️

### **Handling Data Corruption**

* **Causes**:
  * **Power Failures**: Sudden shutdowns can lead to data corruption.
  * **System Failures**: Software bugs or crashes can corrupt data. ⚡

### **NTFS Features for Recovery**

1. **Journaling**:
   * **Function**: Logs changes to file metadata in the NTFS Log.
   * **Benefit**: Helps recover the file system to a consistent state after corruption by referencing the log. 📜
2. **Self-Healing**:
   * **Function**: Automatically fixes minor issues and corruption in the background while Windows is running.
   * **Checking Status**: Use the command `fsutil repair query C:` to check self-healing status. 🔍
3. **Check Disk Utility**:
   * **Function**: Repairs serious disk corruption, such as bad sectors or disk failures.
   * **Usage**:
     * **Read-Only Mode**: `chkdsk` command provides a report without making changes.
     * **Fix Issues**: Use `chkdsk /F` to automatically fix problems. 🛠️
     * **Specify Drive**: For example, `chkdsk D: /F` to check and fix the D: drive.

* **Automatic Checks**: Windows sets a bit in a metadata file to indicate corruption. During boot, `chkdsk` will check this bit and attempt repairs if necessary. 🔄

Windows NTFS provides robust mechanisms to handle and recover from file system corruption, making it resilient against data loss and disk issues. 🌟

***

## Linux Filesystem Repair 🛠️🐧

### **Manual Filesystem Repair**

* **`fsck` Command**:
  * **Purpose**: Used for checking and repairing file systems.
  * **Important**: Ensure the file system is unmounted before running `fsck` to avoid damage. 🚫
  * **Limitations**: While `fsck` can help repair most issues, it doesn't guarantee a fix. 🛠️

### **Automatic File System Checks**

* **Boot-Time Checks**:
  * **Function**: On some Linux versions, `fsck` automatically runs during boot to check and attempt repairs on the file system. 🔄
  * **Configuration**: Learn how to enable and configure this feature for advanced usage in supplementary readings. 📚

### **Importance in IT Support**

* **Data Protection**: Understanding disk management and file system repair is crucial for IT support roles. Customers rely on these systems to safeguard their important data, including personal photos, presentations, and music. 📸📊🎶

Effective disk management ensures the safety and reliability of user data, making it an essential skill for IT professionals. 🌟
