What are the commands to check for bad sectors in all partitions of SSD that is running Ubuntu?If I get the awnser,probably I'll ask about how to fix this in the next post... Being carefully to don't posting a duplicated question.
To determine the DEVICE name of SSD, e.g. sda, sdb, sdc, etc.
smartctl -a /dev/DEVICE
Where DEVICE is the name from the first command. This will produce all the statistics for your SSD.
Typically, Reallocated_Sector_Ct is associated with the count of sectors that have been flagged as bad.
If necessary, smartmontools is the package to install for the smartctl utility.
I think you're looking for
badblocks, but I always check SMART data first (ie. ask the drive how healthy it is using its logs) using
gnome-disks before I use it.
man badblocks provide the following (or you can read it online with http://manpages.ubuntu.com/manpages/xenial/man8/badblocks.8.html)
badblocks is used to search for bad blocks on a device (usually a disk partition). device is the special file corresponding to the device (e.g /dev/hdc1). last-block is the last block to be checked; if it is not specified, the last block on the device is used as a default. first-block is an optional parameter specifying the starting block number for the test, which allows the testing to start in the middle of the disk. If it is not specified the first block on the disk is used as a default.