Тёмный

Check & Repair Different Filesystems in Linux | Ext2, Ext3, Ext4, XFS, ZFS Repair in Linux 

Nehra Classes
Подписаться 50 тыс.
Просмотров 25 тыс.
50% 1

Check & Repair Different Filesystems in Linux | Ext2, Ext3, Ext4, XFS, ZFS Repair in Linux
========
FSCK stands for File System Consistency Check & most of the times, it runs at boot time but can also be started manually by super user, if need arises.
It can be used with 3 modes of operation;
1- Check for errors & let the user decide what should be done with each error.
2- Check for errors & make repairs automatically.
3- Check for errors & display the error but does not perform any repairs.
We can use the FSCK command manually with the following syntax:
fsck options drives
The options that can be used with fsck command are,
-p Automatic repair (no questions)
-n Make no changes to the filesystem
-y Assume “yes” to all questions
-c Check for bad blocks and add them to the badblock list
-f Force checking even if filesystem is marked clean
-v Be verbose
-b superblock Use alternative superblock
-B blocksize Force blocksize when looking for superblock
-j external_journal Set location of the external journal
-l bad_blocks_file Add to badblocks list
-L bad_blocks_file Set badblocks list
We can use any of the following options, depending on the operation we need to perform.
we must un-mount the drive with the following command,
umount drivename
e.g.
umount /dev/sdb
You can check the partition number with the following command,
fdisk -l
Now let’s discuss usage of fsck command with examples,
To perform a file check on a single partition, run the following command from the terminal,
umount /dev/sdc1
fsck /dev/sdc1
Check filesystem for errors & repair them automatically
Run the fsck command with ‘a’ option to perform consistency check & to repair them automatically, execute the following command. We can also use ‘y’ option in place of option ‘a’.
fsck -a /dev/sdb1
Check filesystem for errors but don’t repair them
In case we only need to see the error that are occurring on our file system & dont need to repair them, than we should run fsck with option ‘n’,
fsck -n /dev/sdb1
Perform an error check on all partitions
To perform a filesystem check for all partitions in single go, use fsck with ‘A’ option, You can check all the filesystems in a single run of fsck using this option. This checks the file system in the order given by the fs_passno mentioned for each filesystem in /etc/fstab.
Please note that the filesystem with a fs_passno value of 0 are skipped, and greater than 0 are checked in the order.
The /etc/fstab contains the entries as listed below,
cat /etc/fstab
/dev/mapper/rhel-root / xfs defaults 0 0
UUID=91890bfd-31c5-44a1-b75a-3a3fe2de0e68 /boot xfs defaults 0 0
/dev/mapper/rhel-swap swap swap defaults 0 0
/dev/sdb /ext3_data ext3 defaults 0 1
/dev/sdc1 /ext2_data ext2 defaults 0 2
#/dev/sdc2 /xfs_data xfs defaults 0 3
Here, the filesystem with the same fs_passno are checked in parallel in your system.
fsck -A -y
To disable the root file system check, we will use the option ‘R’
fsck -AR -y
Check only partition with mentioned filesystem
In order to run fsck on all the partitions with mentioned filesystem type, for example ‘ext4’, use fsck with option ‘t’ followed by filesystem type,
fsck -t ext4 /dev/sdb1
or
fsck -t -A ext4
Perform consistency check only on unmounted drives
To make sure that the fsck is performed only on unmounted drives, we will use option ‘M’ while running fsck,
fsck -AM -y
Repair a XFS filesystem using xfs_repair
The xfs_repair utility can be used to repair a corrupted or damaged XFS file system. The basic syntax used by xfs_repair is as follows:
xfs_repair /mount/point
xfs_repair /dev/sdc2
NOTE: Make sure you umount the XFS filesystem first before running the xfs_repair command.
Similar to the fsck utility, the xfs_repair utility fixes unmounted xfs filesystems in series of phases.
*****
Join this channel to get access to perks:
/ @nehraclasses
*****
My Macbook: amzn.to/3lUdbkC
My Avita PC: amzn.to/30amhRt
My DSLR Camera: amzn.to/36954Ml
My Boya Microphone: amzn.to/3mZavTS
My iPhone: amzn.to/3lWa63j
My Gaming Router: amzn.to/3j3dQON
My FireStick: amzn.to/345150F
My Head-Phone: amzn.to/3ie4rDB
My Smart Watch: amzn.to/3dzJeTF
******
Contact Us:
WhatsApp: bit.ly/2Kpqp5z
Telegram Channel: t.me/NehraClasses
Email: nehraclasses@gmail.com
******
Follow Us On Social Media Platforms:
Twitter: / nehraclasses
Facebook Page: / nehraclasses
Instagram: / nehraclasses
Website: nehraclasseson...
=======
©COPYRIGHT. ALL RIGHTS RESERVED.

Опубликовано:

 

14 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 37   
@chetanghadge3075
@chetanghadge3075 21 день назад
Thanks sir, This is very informative video. Keep it up. Pranam guruji.... 🙏🙏🙏🙏
@TheSillybits
@TheSillybits 4 месяца назад
Very nice video tutorial. I was wondering, is it possible to do the same to Apple file system(s) under Linux?
@NehraClasses
@NehraClasses 4 месяца назад
Yes, absolutely
@philosphize
@philosphize Год назад
This is very useful crisp and clear
@AshokKumar-jv3yj
@AshokKumar-jv3yj 2 года назад
simply awesome always your class
@SunLISunTube
@SunLISunTube 2 месяца назад
Hello I am booting from Raspberry Pi 4 8 GB from a SSD. It got some error on this drive i.e, sda2 . I also found out this drive is not mounted?!! I would like check both sda1 and sda2. Is it completely to safe to run fsck after unmount them ?
@NehraClasses
@NehraClasses 2 месяца назад
Running `fsck` (File System Consistency Check) on your Raspberry Pi’s SSD partitions is a common method to check and repair file system errors. However, there are a few things to keep in mind to ensure you do this safely: ### Steps to Run `fsck` Safely: 1. **Check if the Partitions are Mounted:** - Before running `fsck`, you need to ensure that the partitions (`/dev/sda1` and `/dev/sda2`) are unmounted. You can check if they are mounted with the following command: ```bash mount | grep sda ``` - If they are mounted, you'll see output indicating where they are mounted (e.g., `/mnt/sda1`). If no output is returned, the partitions are not mounted. 2. **Unmount the Partitions (If Mounted):** - If you find that the partitions are mounted, you need to unmount them before running `fsck`: ```bash sudo umount /dev/sda1 sudo umount /dev/sda2 ``` - It’s important to unmount the partitions because running `fsck` on a mounted partition can lead to data corruption. 3. **Run `fsck` on the Unmounted Partitions:** - Once the partitions are unmounted, you can safely run `fsck`: ```bash sudo fsck /dev/sda1 sudo fsck /dev/sda2 ``` - Follow the on-screen prompts. `fsck` will scan the partitions and attempt to fix any detected issues. 4. **Reboot (If Necessary):** - After running `fsck`, you can either manually remount the partitions or simply reboot the Raspberry Pi: ```bash sudo reboot ``` - Upon reboot, the system should automatically mount the partitions if they are listed in `/etc/fstab`. ### Additional Tips: - **Backup Important Data**: If possible, backup important data before running `fsck`, especially if you suspect significant file system issues. - **Monitor `fsck` Output**: Pay attention to any warnings or errors during the `fsck` process. If `fsck` suggests repairs, it's usually safe to agree, but understanding the implications is essential. By unmounting the partitions before running `fsck`, you minimize the risk of data corruption and ensure a safer repair process.
@SunLISunTube
@SunLISunTube 2 месяца назад
@@NehraClasses Well this is great 👍 I did fixed the errors like you explained by fsck. Thanks for your kind explanation.
@uroojahmad8703
@uroojahmad8703 2 года назад
Very appreciative ❤️❤️
@somathilakesuraweera1673
@somathilakesuraweera1673 3 года назад
Very educative , thank you. presentation is excellent.
@NehraClasses
@NehraClasses 3 года назад
Thanks 🙏🙏
@GK-qk7xf
@GK-qk7xf 3 года назад
Thank you sir, really helpfull for preparing for interview
@NehraClasses
@NehraClasses 3 года назад
Welcome brother
@yadakrishna2090
@yadakrishna2090 Год назад
I have one doubt example if we have 2 disk which is mounted same mount point and using same vg and lv for the two disk partitions... Later if i want to remove one disk how can perform fhe task with out loosing the data please make a video ???
@abhishekrana9016
@abhishekrana9016 11 месяцев назад
i have installed ubuntu in a external ssd. i had made projects in that using ros. pc got shutdown while i was sudo upgrade in ubuntu . when i resatrt my pc i boot ssd and then i choose option Ubuntu and after that processing goes on and then it start processing like blk_update : I/O error,dev sdb , recovery journal . superblock recovery jounal if i do fsck it is showing error as : fsck.ext4: Input/output error while recovering journal fsck.ext4: superblock when i formating thorough gpart it is showing same error as input.out error
@Ibrahim-sz2tl
@Ibrahim-sz2tl 3 года назад
Small correction - please edit the thumbnail as the spelling of repair was wrong. Btw great video
@NehraClasses
@NehraClasses 3 года назад
Thanks
@knowledgered1572
@knowledgered1572 3 года назад
manage container are available in rhcsa8 course?
@NehraClasses
@NehraClasses 3 года назад
Yes, we will cover up all topics of rhel8
@eyesoffloraandfauna8728
@eyesoffloraandfauna8728 3 года назад
Sir help 🙏 I. Accidentally deleted var directory in kali because I was installing DVWA in kali 2021 and then I factory reset it var directory install automatically but I can't able to update my system it showing error :output directory /var/lib/debtags/does not exist....
@NehraClasses
@NehraClasses 3 года назад
Did you take backup? Please contact us in our telegram channel
@eyesoffloraandfauna8728
@eyesoffloraandfauna8728 3 года назад
@@NehraClasses ok I contact u
@pbbhosale9
@pbbhosale9 3 месяца назад
sir file size 10 gb can able reduce 8 gb ?
@NehraClasses
@NehraClasses 3 месяца назад
Yes
@akshaywagh4589
@akshaywagh4589 3 года назад
But what if the server is live...how can u unmount the device???
@NehraClasses
@NehraClasses 3 года назад
umount
@akshaywagh4589
@akshaywagh4589 3 года назад
@@NehraClasses unmounting while server is live is not the best practice.... do we need to run e2fsck -a /dev/sda1 to check and repair the bad blocks?
@NehraClasses
@NehraClasses 3 года назад
What is the issue? Can u please let us know in our telegram channel, so that we can help you?
@jacobmax5615
@jacobmax5615 Год назад
👍👍👍
@helpdeskagraproducts3310
@helpdeskagraproducts3310 Год назад
Sound knowledge
@kirankumarvura2394
@kirankumarvura2394 2 года назад
Excellent sir Plz share notes
@NehraClasses
@NehraClasses 2 года назад
Please contact us in telegram.
@kirankumarvura2394
@kirankumarvura2394 2 года назад
@@NehraClasses telegram link plz
@NehraClasses
@NehraClasses 2 года назад
You can search Nehra classes on telegram or click this link to join: t.me/NehraClasses
@SivaPrasad-ol1gh
@SivaPrasad-ol1gh 2 года назад
Pls make all videos in English only, am from South
@NehraClasses
@NehraClasses 2 года назад
We have already covered all the topics in english
@Kenneth47
@Kenneth47 Год назад
It can be a challenge for some individuals to speak with a clearer accent. Perhaps the presenter might benefit from speaking slightly slower and focusing on certain phonemes.
Далее
Introduction to the Ext4 File System for Linux
55:28
Просмотров 66 тыс.
28   Using fsck to Check and Repair Filesystem Errors
5:21
Troubleshooting boot issues of RHEL
1:31:07
Просмотров 4,8 тыс.
The Tragedy of systemd
47:18
Просмотров 1,1 млн
Linux Performance Troubleshooting Demos
10:51
Просмотров 67 тыс.