With spinning disks, there are 2 important lines which are ‘Reallocated_Sector_Ct’ and ‘Current_Pending_Sector’ count, the reallocated sector count means you have bad sectors but the disk has dealt with them fine, this is not terrible if the count is either low <1000 or static and not growing over time if however you have Current_Pending_Sectors for more than 24 hours that means the disk has issues and it cannot deal with them itself, this is critical. You can then check the disk health with: #smatctl -a /dev/sda With spinning disks let us again assume that the disk is /dev/sda you can run a short or a long test as follows: #smartctl -t short -a /dev/sda (This is a short self test) To see the overall health you can check the ‘Wear_leveling_count’ line, this starts at 100 and reduces down to 0, again this is simply a vendor estimate of the % of the remaining life of the disk if you are getting filesystem issues and slow performance then the disk may be at the end of its best days. You are then looking for any specific errors logged at the end which will be very obvious and titled as errors, if you find these please copy and paste them into a ticket for us to review. #smartctl -t long -a /dev/sda (This is a long self test) With SSD’s you can use the regular smart tests, assuming that the disk is /dev/sda you can run a short or a long test as follows: #smartctl -t short -a /dev/sda (This is a short self test) It is however VERY important to keep in mind that you can be at 100% and still see no issues with the disk, this is simply a vendor estimate of the % of the remaining life of the disk if you are getting filesystem issues and slow performance then the disk may be at the end of its best days. The closer to 100% you get the more your disk is close to the end of its predicted life. Now we know the disk is nvme0 we can check its health: Node SN Model Namespace Usage Format FW Rev You will see a list of NVMe disks: # nvme list If you do not have this installed use your package manager to install ‘nvme-cli’, you will also need ‘smartmontools’ On this topic.It is a good idea to do regular checks of your server disks, however with a number of disk types now, Spinning HDD’s SSD’s and NVMe disks there are different ways to check them, this guide is intended to give you indications only it is not black and white between good and bad disks. You may wish to consult the following resources for additional information If fsck gets interrupted, it will complete any checks in process, but will not attempt to repair any errors it finds. To check and attempt to repair any errors on /dev/sda, use this format: fsck -y /dev/sda This example uses fsck to check all file systems except the root, and will attempt repair using the interactive feature: fsck -AR -y Use the -r option to use the interactive repair option. The error codes that fsck returns can be understood with the following table from : Code This example checks all file systems ( -A) on /dev/sda: fsck -A /dev/sda Run fsck on the target disk, using the desired options. If the disk is declared in /etc/fstab, change the mount point to none there as well. Use umount to unmount the disk location copied in the previous step: umount /dev/sda If you are working on a local machine, unmount the disk manually. Unmount the disk from the Configuration Profile. If you are working on a Linode but do not wish to use Rescue Mode, shut down the Linode from the Linode Manager. Use fdisk to view disk locations: fdisk -lĬopy the location of the target disk to use with the fsck command. If you are using Rescue Mode, the disk you want to check should not be listed: df -h Run df to view a list of currently mounted disks. View Mounted Disks and Verify Disk Location fsck should be run only as a user with root permissions. If you’re working on a local machine, consider using the distribution’s recovery mode or a live distribution to avoid working on a mounted disk. Visit our Rescue and Rebuild guide for instructions on how to boot your Linode into Rescue Mode. If you are using fsck on a Linode, the easiest and safest way to unmount your disk is to use Rescue Mode. If using the -A option, do not check the root filesystem.Ĭheck only a specific type of filesystem. Use with the -A option to run multiple checks in parallel. Describes what would happen without executing the check itself. Show progress bar (ext2 and ext3 file systems only). Was this helpful Please add a comment to show your appreciation or feedback. Join the nixCraft community via RSS Feed or Email Newsletter. He wrote more than 7k+ posts and helped numerous readers to master IT topics. Use with caution.įorce fsck to check a file system even if it thinks it’s clean. About the author: Vivek Gite is the founder of nixCraft, the oldest running blog about Linux and open source. fsck Options and Arguments OptionĪttempt to fix errors automatically. You risk corrupting your file system and losing data if you run fsck on an active disk.
0 Comments
Leave a Reply. |