NEVER use this on a drive with mounted file systems! badblocks refuses to operate on those anyway, unless you force it.ĭon't interrupt this operation forcefully! Ctrl+ C (SIGINT/SIGTERM) and waiting for graceful premature termination is ok, but killall -9 badblocks (SIGKILL) isn't. (This will not reliably discover (flash) media, that advertise a larger size, than they actually have use Fight Flash Fraud instead.) Sometimes – especially with flash media – an error only occurs when trying to write. quite safe (barring a power failure or intermittent kernel panic).
We can also tweak the amount of data ( -c, in blocks) tested at once to improve throughput 16 MiB should be alright for most devices. Note for advanced usage: if we want to reuse the output for e2fsck, we need to set the block size ( -b) to that of the contained file system. It's possible to abort automatically on error with the option -e 1. We can safely abort the operation at any moment (even forcefully like during a power failure), if we're not interested in the exact amount (and maybe location) of bad blocks. If the error count rises above zero, we'll know that there's a bad block. This operation can take a lot of time, especially if the storage drive actually is damaged. To test the read integrity of the whole device without writing to it, we can use badblocks(8) like this: sudo badblocks -b 4096 -c 4096 -s /dev/sdc How can I check the SMART status of a drive on Ubuntu 14.04 through 16.10?.Most removable flash media don't support it. This is generally the best option, but usually only available on (non-ancient) hard disk and solid state drives. or instructed to perform integrity self-tests of different thoroughness. warns about likely failure in the near futureĭevices that support it, can be queried about their health through S.M.A.R.T.instantaneous to slow or slower (depends on thoroughness of the test).
How to run a disk check on main disk windows#
(I've come across USB drives that work on Windows without special drivers, but not on Linux or OS X.) S.M.A.R.T. In the latter case, a different operating system is worth a try. In the a former case, with a bit of luck, a data recovery specialist with an appropriately equipped lab can salvage its content. If this command results in a message about an “Input/output error”, our drive is broken or otherwise fails to interact with the Linux kernel as expected. This can be verified easily with: sudo dd if=/dev/sdc of=/dev/null count=1 It still appears as a block device to the kernel and in the disk manager, but its first sector holding the partition table is not readable. Sometimes a storage medium simply refuses to work at all.
Sudo fsck -t ext4 -l bad-blocks-result /dev/sda1 To just check, or to check and fix first write the result to a temporary file: sudo badblocks -sv /dev/sda > bad-blocks-result You can also use badblocks sudo badblocks -sv /dev/sda The program is bundled in the gnome-disk-utility package. Even if you don't see any bad blocks there, launch a self-test to be sure. To check for bad sectors check the SMART data, probably the best accessible by launching the Disks utility ( Palimpsest).