2

Debian on SSD. How to check SSD disk for errors from a Live CD? Additionally, to save results to a txt file. Partitions are

sdb1 /boot ext2 sdb2 root ext4 sdb3 swap 

Should I unmount partitions when run fsck from Live CD, or its not mounted?

# fsck.ext4 /dev/sdb2 # fsck.ext2 /dev/sdb1 

Also, should I first try smartctl -a /dev/sdb command?

EDIT: fsck -n -f results

Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information BOOT: 240/128000 files (1.3% non-contiguous), 32621/256000 blocks Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information ROOT: 101764/2498560 files (0.2% non-contiguous), 894670/9984000 blocks 
7
  • What errors exactly are you after? Hardware errors or file system errors? Commented Sep 30, 2014 at 14:39
  • @peterph debian crashed and then, when try log out "Failed to execute command Xfce-4-session-logout.(no such file or directory)", only been able to shutdown by manually held power button, during this system gone in terminal mode with a few messages displayed: [12055.788372] ETX4-fs error (device sdb2): ext4_find_entry:932: inode # 1572866: comm lightdm: reading iblock 0" Commented Sep 30, 2014 at 15:43
  • What exactly you mean by "debian crashed"? Crash (as I understand it) usually involves the machine halting on a kernel panic. No logout of any kind is possible then. Commented Sep 30, 2014 at 16:11
  • well, in that case Desktop crashes, file manager show no folders, click on any directory return "Failed to execute command..", canno log out. Problem gone after a hard reboot. Commented Sep 30, 2014 at 16:25
  • Hmm, you weren't by chance in the process of upgrading some software (especially core libraries/programs)? Commented Sep 30, 2014 at 16:26

2 Answers 2

4

If your partitions are mounted depends on the Live CD, the ones I used until now did not automount harddisk partitions.

In general, fsck should not be run on filesystems, which are mounted writeable. To be sure, you can use the -M switch for fsck, which causes an error if the filesystem is mounted. Also, you can use -n to only check, without attempting repairs, which may be desirable, if you want save the output. To write it to a textfile, you can use shell redirection, e.g.:

fsck.ext4 -n /dev/sdb2 > fsck-results.txt 

If running smartctl makes sense, depends on what kind of error you expect. If you suspect your SSD may have hardware problems, smartctl is the right tool, if your filesystems are corrupted because of other reasons (e.g. power loss during a write), it is nothing S.M.A.R.T. will detect. But in any case, running smartctl -a /dev/sdb should not have any effect on the disk content, so it won't do any harm to run it, even if it is no hardware problem.

2
  • I accidentally run fsck check on mounted boot partition: can this corrupt data on that partition? Warning! /dev/sdb1 is mounted. BOOT was not cleanly unmounted, check forced. Commented Sep 30, 2014 at 18:59
  • It depends on what fsck did. If fsck corrected any errors, this could lead to corrupted data, if only the check is performed there should not be a problem. See also serverfault.com/questions/29889/… Commented Oct 3, 2014 at 17:25
1

Why do you need to check from a live CD? if your partition is ext2/3/4 which is the most probable scenario, the system checks the disk every X system startups or every X days from the last check. You can vary those periods of time with tune2fs and your drive will be checked when the system is started and the period has been reached.

Anyway, you can start from a live CD, and from the console do a fsck -f /dev/sdb1 2>&1 > Your_log_file.txt If you want to check bad blocks add -c to the command. Once you have finished your checks mount your root partition and move Your_log_file.txt there so that when you start your system the log file is there.

No, partitions must not be mounted when a check is going to take place.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.