Проверить диск на ошибки freebsd

FreeBSD

Подробности
Категория: FreeBSD
Опубликовано 28.10.2012 11:23
Автор: 1111
Просмотров: 7520

Рано или поздно это случается, а именно крах системы или раздела, невозможность проверить файловую систему и т.д. Поэтому системный администратор должен знать что делать в таких ситуациях, так сказать знать как «Отче наш».

1) fsck при загрузке ОС

Когда случается сбой питания в работу вступает fsck: file system consistency check and interactive repair или если на русском, то «проверка целосности файловой системы и интерактивное восстановление». По умолчанию проверка дисков отключена. Что бы её включить при загрузке системы, добавим такую строчку

fsck_y_enable="YES"

в файл /etc/rc.conf. В этом случае, при некорректном завершении работы сервера, будет автоматически запускаться проверка всех файловых систем.

Сама проверка состоит из 5-ти этапов:

** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups


На самом деле, Phase 1 ещё подразделяется на 1a и 1b. Это можно заметить только тогда, когда случился серъёзный крах.

Всё это хорошо, но есть одно НО! Когда происходит проверка файловой системы, то пока раздел не провериться, он не смонтируется и станет доступным, соответственно, увеличивается время загрузки сервера. Разработчики и это предусмотрели и сделали возможным запуск проверки в «фоне». Хотя на самом деле это только попытка, но всё же лучше, чем ничего. по умолчанию она включена. Правда по этому поводу точаться дискуссии на тему «нужно ли включать проверку в фоне или нет». Решать вам.

Есть один неприятный момент в процессе проверки ФС при загрузке. Если раздел достаточно большой, то его проверка может занять длительное время, при этом, fsck как бы зависает на каждом из этапов. Иными словами визуально непонятно, то ли идёт проверка, то ли сервер завис. Ну и при всём при этом непонятно, сколько уже проверено и сколько будет проверяться. Что бы немного облегчить жизнь системным администраторам, разработчики внедрили недокументированую возмножность. нажатие комбинации Ctrl+T показывает текущее состояние проверки: сколько уже проверено, в процентах. Если через пару минут захотите узнать опять состояние – нужно снова нажать Ctrl+T и так каждый раз.

Есть несколько параметров, которые прописываются в /etc/rc.conf и касаются fsck. Ниже приведены их дефолтные значения:

fsck_y_enable="NO" # Включить проверку при запуске, если работа была завершена некорректно.
fsck_y_flags="" # Дополнительные флаги для fsck -y
background_fsck="YES" # Попытка запустить проверку в фоне
background_fsck_delay="60" # Время задержки перед запуском fsck в фоне.

Я рекомендую прописать в /etc/rc.conf только такое:

fsck_y_enable="YES"

И так, вот примеры работы fsck:

— если сервер выключался корректно, то при загрузке мы увидим такое сообщение:

Nov 10 14:36:33 mail kernel: Starting file system checks:
Nov 10 14:36:33 mail kernel: /dev/da0s1a: FILE SYSTEM CLEAN; SKIPPING CHECKS
Nov 10 14:36:33 mail kernel: /dev/da0s1a: clean, 942456 free (2944 frags, 117439 blocks, 0.3% fragmentation)
Nov 10 14:36:33 mail kernel: /dev/da0s1d: FILE SYSTEM CLEAN; SKIPPING CHECKS
Nov 10 14:36:33 mail kernel: /dev/da0s1d: clean, 503428 free (60 frags, 62921 blocks, 0.0% fragmentation)
Nov 10 14:36:33 mail kernel: /dev/da0s1e: FILE SYSTEM CLEAN; SKIPPING CHECKS
Nov 10 14:36:33 mail kernel: /dev/da0s1e: clean, 2301104 free (50872 frags, 281279 blocks, 1.0% fragmentation)
Nov 10 14:36:33 mail kernel: /dev/da0s1f: FILE SYSTEM CLEAN; SKIPPING CHECKS
Nov 10 14:36:33 mail kernel: /dev/da0s1f: clean, 162210122 free (2260506 frags, 19993702 blocks, 0.5% fragmentation)
Nov 10 14:36:33 mail kernel: Mounting local file systems:


Наличие ключевой фразы FILE SYSTEM CLEAN; SKIPPING CHECKS свидетельствует о предыдущем корректном завершении.

— если некорректно, то такое

Starting background file system checks in 60 seconds.
Jan 26 18:39:19 mail kernel: Starting file system checks:
Jan 26 18:39:19 mail kernel: /dev/da0s1a: 56013 files, 201857 used, 3349718 free (1702 frags, 418502 blocks, 0.0% fragmentation)
Jan 26 18:39:19 mail kernel: /dev/da0s1d: DEFER FOR BACKGROUND CHECKING
Jan 26 18:39:19 mail kernel: /dev/da0s1f: DEFER FOR BACKGROUND CHECKING
Jan 26 18:39:19 mail kernel: /dev/da0s1e: DEFER FOR BACKGROUND CHECKING


Но такое происходит не всегда. Если попытка не увенчалась успехом, то мы увидим такое:

** /dev/ad2s1g (NO WRITE)
** Last Mounted on /var
** Phase 1 - Check Blocks and Sizes

INCORRECT BLOCK COUNT I=446041 (4 should be 0)
CORRECT? yes
INCORRECT BLOCK COUNT I=446045 (4 should be 0)
CORRECT? yes

** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts

UNREF FILE I=89148 OWNER=root MODE=100600
SIZE=376 MTIME=Aug 13 13:49 2006
RECONNECT? yes
CLEAR? yes
UNREF FILE I=89152 OWNER=root MODE=100600
SIZE=755 MTIME=Aug 13 13:49 2006
RECONNECT? yes
CLEAR? yes

** Phase 5 - Check Cyl groups

FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? yes
SUMMARY INFORMATION BAD
SALVAGE? yes
BLK(S) MISSING IN BIT MAPS
SALVAGE? yes
2242 files, 1607116 used, 973436 free (2196 frags, 121405 blocks, 0.1% fragmentation)

2) Ручной запуск fsck

Сразу замечу, что проверка делается ТОЛЬКО НА НЕ СМОНТИРОВАННОМ РАЗДЕЛЕ! Иначе можете потерять все данные.
И так, рассмотрим только те параметры, которые часто используются. А именно

-y|-n: этот параметр будет отвечать соответственно YES|NO на все вопросы при возникновении несоответствий.
-B|-F : соответственно фоновый и нефоновый режимы
-f : проверить раздел, даже если он был отключён корректно.

Рекомендую запускать с такими параметрами:

fsck -y -f /dev/ad2s1g

Если запустить без параметра -y, то при проверке и нахождении несоответствий будет выдаваться вопрос, на что можно ответить Y или N. обычно отвечают Y. Не очень удобно каждый раз отвечать Y, поэтому лучше запускать с параметром Y

** /dev/ad2s1g (NO WRITE)
** Last Mounted on /var
** Phase 1 - Check Blocks and Sizes

INCORRECT BLOCK COUNT I=446041 (4 should be 0)
CORRECT?

Есть хорошая новость: комбинация CTRL+T работает и в ручном режиме.

На чтение 8 мин. Опубликовано 15.12.2019

Допустим настал черный день – и Вы увидели на консоле системы такую надпись —

1. Загружаемся в Single User Mode(Одно пользовательский режим) или используем Rescue-CD диск.

2. Отмонтируем файловую систему.

y — отвечать yes на все вопросы (альтернатива: ключ p — запускает проверку в полностью автоматическом режиме);
f — принудительная проверка (проводится даже если файловая система помечена как работоспособная);
c — искать битые блоки (bad blocks) и помечать их соответствующим образом;
/dev/sda1 — устройство и раздел, которые следует проверять (в данном случае, указан первый раздел первого диска).
v – verbose, будет выводить детальную информацию на терминал

Если есть вопросы, то просим Вас посетить наш форум, на котором Вы сможете попросить бесплатно описание.

Содержание

  1. Проверка дисков fsck
  2. FreeBSD 11: Проверка состояния SMART жёстких дисков
  3. Остались вопросы?
  4. Лоджик Флоу
  5. Эти статьи будут Вам интересны
  6. Ошибка при запуске приложения (0xc0000005). Для выхода из приложения нажмите кнопку «ОК»
  7. Ошибка Центра обновления 8007000E Windows 7 и Windows Server 2008R2
  8. NTLDR is missing. BOOTMGR is missing
  9. База знаний «Try 2 Fix»

Проверка дисков fsck

Рано или поздно это случается, а именно крах системы или раздела, невозможность проверить файловую систему и т.д. Поэтому системный администратор должен знать что делать в таких ситуациях, так сказать знать как «Отче наш».

1) fsck при загрузке ОС

Когда случается сбой питания в работу вступает fsck: file system consistency check and interactive repair или если на русском, то «проверка целосности файловой системы и интерактивное восстановление». По умолчанию проверка дисков отключена. Что бы её включить при загрузке системы, добавим такую строчку

fsck_y_enable=»YES»

в файл /etc/rc.conf. В этом случае, при некорректном завершении работы сервера, будет автоматически запускаться проверка всех файловых систем.

Сама проверка состоит из 5-ти этапов:

** Phase 1 — Check Blocks and Sizes
** Phase 2 — Check Pathnames
** Phase 3 — Check Connectivity
** Phase 4 — Check Reference Counts
** Phase 5 — Check Cyl groups

На самом деле, Phase 1 ещё подразделяется на 1a и 1b. Это можно заметить только тогда, когда случился серъёзный крах.

Всё это хорошо, но есть одно НО! Когда происходит проверка файловой системы, то пока раздел не провериться, он не смонтируется и станет доступным, соответственно, увеличивается время загрузки сервера. Разработчики и это предусмотрели и сделали возможным запуск проверки в «фоне». Хотя на самом деле это только попытка, но всё же лучше, чем ничего. по умолчанию она включена. Правда по этому поводу точаться дискуссии на тему «нужно ли включать проверку в фоне или нет». Решать вам.

Есть один неприятный момент в процессе проверки ФС при загрузке. Если раздел достаточно большой, то его проверка может занять длительное время, при этом, fsck как бы зависает на каждом из этапов. Иными словами визуально непонятно, то ли идёт проверка, то ли сервер завис. Ну и при всём при этом непонятно, сколько уже проверено и сколько будет проверяться. Что бы немного облегчить жизнь системным администраторам, разработчики внедрили недокументированую возмножность. нажатие комбинации Ctrl+T показывает текущее состояние проверки: сколько уже проверено, в процентах. Если через пару минут захотите узнать опять состояние – нужно снова нажать Ctrl+T и так каждый раз.

Есть несколько параметров, которые прописываются в /etc/rc.conf и касаются fsck. Ниже приведены их дефолтные значения:

fsck_y_enable=»NO» # Включить проверку при запуске, если работа была завершена некорректно.
fsck_y_flags=»» # Дополнительные флаги для fsck -y
background_fsck=»YES» # Попытка запустить проверку в фоне
background_fsck_delay=»60″ # Время задержки перед запуском fsck в фоне.

Я рекомендую прописать в /etc/rc.conf только такое:

fsck_y_enable=»YES»

И так, вот примеры работы fsck:

— если сервер выключался корректно, то при загрузке мы увидим такое сообщение:

Nov 10 14:36:33 mail kernel: Starting file system checks:
Nov 10 14:36:33 mail kernel: /dev/da0s1a: FILE SYSTEM CLEAN; SKIPPING CHECKS
Nov 10 14:36:33 mail kernel: /dev/da0s1a: clean, 942456 free (2944 frags, 117439 blocks, 0.3% fragmentation)
Nov 10 14:36:33 mail kernel: /dev/da0s1d: FILE SYSTEM CLEAN; SKIPPING CHECKS
Nov 10 14:36:33 mail kernel: /dev/da0s1d: clean, 503428 free (60 frags, 62921 blocks, 0.0% fragmentation)
Nov 10 14:36:33 mail kernel: /dev/da0s1e: FILE SYSTEM CLEAN; SKIPPING CHECKS
Nov 10 14:36:33 mail kernel: /dev/da0s1e: clean, 2301104 free (50872 frags, 281279 blocks, 1.0% fragmentation)
Nov 10 14:36:33 mail kernel: /dev/da0s1f: FILE SYSTEM CLEAN; SKIPPING CHECKS
Nov 10 14:36:33 mail kernel: /dev/da0s1f: clean, 162210122 free (2260506 frags, 19993702 blocks, 0.5% fragmentation)
Nov 10 14:36:33 mail kernel: Mounting local file systems:

Наличие ключевой фразы FILE SYSTEM CLEAN; SKIPPING CHECKS свидетельствует о предыдущем корректном завершении.

— если некорректно, то такое

Starting background file system checks in 60 seconds.
Jan 26 18:39:19 mail kernel: Starting file system checks:
Jan 26 18:39:19 mail kernel: /dev/da0s1a: 56013 files, 201857 used, 3349718 free (1702 frags, 418502 blocks, 0.0% fragmentation)
Jan 26 18:39:19 mail kernel: /dev/da0s1d: DEFER FOR BACKGROUND CHECKING
Jan 26 18:39:19 mail kernel: /dev/da0s1f: DEFER FOR BACKGROUND CHECKING
Jan 26 18:39:19 mail kernel: /dev/da0s1e: DEFER FOR BACKGROUND CHECKING

Но такое происходит не всегда. Если попытка не увенчалась успехом, то мы увидим такое:

** /dev/ad2s1g (NO WRITE)
** Last Mounted on /var
** Phase 1 — Check Blocks and Sizes

INCORRECT BLOCK COUNT I=446041 (4 should be 0)
CORRECT? yes
INCORRECT BLOCK COUNT I=446045 (4 should be 0)
CORRECT? yes

** Phase 2 — Check Pathnames
** Phase 3 — Check Connectivity
** Phase 4 — Check Reference Counts

UNREF FILE I=89148 OWNER=root MODE=100600
SIZE=376 MTIME=Aug 13 13:49 2006
RECONNECT? yes
CLEAR? yes
UNREF FILE I=89152 OWNER=root MODE=100600
SIZE=755 MTIME=Aug 13 13:49 2006
RECONNECT? yes
CLEAR? yes

** Phase 5 — Check Cyl groups

FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? yes
SUMMARY INFORMATION BAD
SALVAGE? yes
BLK(S) MISSING IN BIT MAPS
SALVAGE? yes
2242 files, 1607116 used, 973436 free (2196 frags, 121405 blocks, 0.1% fragmentation)

2) Ручной запуск fsck

Сразу замечу, что проверка делается ТОЛЬКО НА НЕ СМОНТИРОВАННОМ РАЗДЕЛЕ! Иначе можете потерять все данные.
И так, рассмотрим только те параметры, которые часто используются. А именно

-y|-n : этот параметр будет отвечать соответственно YES|NO на все вопросы при возникновении несоответствий.
-B|-F : соответственно фоновый и нефоновый режимы
-f : проверить раздел, даже если он был отключён корректно.

Рекомендую запускать с такими параметрами:

fsck -y -f /dev/ad2s1g

Если запустить без параметра -y, то при проверке и нахождении несоответствий будет выдаваться вопрос, на что можно ответить Y или N. обычно отвечают Y. Не очень удобно каждый раз отвечать Y, поэтому лучше запускать с параметром Y

** /dev/ad2s1g (NO WRITE)
** Last Mounted on /var
** Phase 1 — Check Blocks and Sizes

INCORRECT BLOCK COUNT I=446041 (4 should be 0)
CORRECT?

Есть хорошая новость: комбинация CTRL+T работает и в ручном режиме.

FreeBSD 11: Проверка состояния SMART жёстких дисков

Проверка SMART жёсткого диска — важная операция, которую надо проводить время от времени. Если в Windows это можно просто сделать с помощью россыпи программ с графическим интерфейсом, то во FreeBSD (если нет GUI) сделать это немного сложнее. Но мы справимся!

  1. Для начала установим всё необходимое из портов. Переходим в
  2. Устанавливаем
  3. Получаем список дисков и разделов

На выходе получим что-то такое

Первая строка — это сам HDD, остальные это разделы на нём. В данном случае у нас один SATA HDD с тремя разделами на нём.
А дальше подставляем название HDD в команду, которой мы можем воспользоваться благодаря установленному порту

Появляется довольно обширная информация по состоянию выбранного HDD. В этом конкретном случаем HDD больше не пригоден для использования, так как у атрибута Reallocated_Sector статус FAILING_NOW. Беда!

Остались вопросы?

Лоджик Флоу

Аутсорсинг / Системное администрирование / Техническая поддержка / Сопровождение 1С:Предприятие

Что-то пошло не так? Специалисты нашей компании помогут Вам разобраться с возникшими проблемами! Обращайтесь! →

Также Ваши вопросы Вы можете задать в нашей группе ВК или на нашем YouTube канале!

Эти статьи будут Вам интересны

Ошибка при запуске приложения (0xc0000005). Для выхода из приложения нажмите кнопку «ОК»

В один прекрасный момент у одного из наших клиентов перестали запускаться все приложения (*.exe файлы). При чём связать появление данной проблемы с какими-то конкретными действиями так и не получилось. Выключали ПК — всё работало, включили .exe не запускаются. Решаем эту проблему!

Ошибка Центра обновления 8007000E Windows 7 и Windows Server 2008R2

12 октября 2016 ВК Tw Fb

Ошибка 8007000E Центра обновления Windows (Windows Update), как ни странно, чаще всего встречается сразу же после чистой установки Windows 7 любой редакции . Не стоит паниковать: решение проблемы достаточно простое, достаточно иметь под рукой Интернет.

NTLDR is missing. BOOTMGR is missing

NTLDR is missing. BOOTMGR is missing — эти ошибки при запуске ОС означают, что потерялся загрузчик Windows. Исправить это достаточно просто и без переустановки.

База знаний «Try 2 Fix»

Все материалы свободны
к распространению с обязательным
указанием источника

FSCK(8) 						    BSD System Manager's Manual 						   FSCK(8)

NAME
fsck -- file system consistency check and interactive repair SYNOPSIS
fsck [-Cdfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype] [-c fstab] [special | node] ... DESCRIPTION
The fsck utility invokes file system-specific programs to check the special devices listed in the fstab(5) file or in the command line for consistency. It is normally used in the script /etc/rc during automatic reboot. Traditionally, fsck is invoked before the file systems are mounted and all checks are done to completion at that time. If background checking is available, fsck is invoked twice. It is first invoked at the tra- ditional time, before the file systems are mounted, with the -F flag to do checking on all the file systems that cannot do background check- ing. It is then invoked a second time, after the system has completed going multiuser, with the -B flag to do checking on all the file sys- tems that can do background checking. Unlike the foreground checking, the background checking is started asynchronously so that other system activity can proceed even on the file systems that are being checked. If no file systems are specified, fsck reads the table /etc/fstab to determine which file systems to check. Only partitions in /etc/fstab that are mounted ``rw'', ``rq'' or ``ro'' and that have non-zero pass number are checked. File systems with pass number 1 (normally just the root file system) are always checked one at a time. If not in preen mode, the remaining entries are checked in order of increasing pass number one at a time. This is needed when interaction with fsck is required. In preen mode, after pass 1 completes, all remaining file systems are checked, in pass number order running one process per disk drive in parallel for each pass number in increasing order. In other words: In preen mode all pass 1 partitions are checked sequentially. Next all pass 2 partitions are checked in parallel, one process per disk drive. Next all pass 3 partitions are checked in parallel, one process per disk drive. etc. The disk drive containing each file system is inferred from the shortest prefix of the device name that ends in a digit; the remaining char- acters are assumed to be the partition and slice designators. If the -t or -T flags are not specified, fsck will attempt to determine the file system type and call the appropriated file system check utility. Failure to detect the file system type will cause fsck to fail with a message that the partition has an unknown file system type. The options are as follows: -C Check if the ``clean'' flag is set in the superblock and skip file system checks if file system was properly dismounted and marked clean. -c fstab Specify the fstab file to use. -d Debugging mode. Just print the commands without executing them. Available only if fsck is compiled to support it. -f Force checking of file systems, even when they are marked clean (for file systems that support this). -n Causes fsck to assume no as the answer to all operator questions, except "CONTINUE?". -p Enter preen mode. In preen mode, only a restricted class of innocuous file system inconsistencies will be corrected. If unexpected inconsistencies caused by hardware or software failures are encountered, the check program will exit with a failure. See the manual pages for the individual check programs for a list of the sorts of failures that they correct when running in preen mode. -F Run in foreground mode. The check program for each file system is invoked with the -F flag to determine whether it wishes to run as part of the boot up sequence, or if it is able to do its job in background after the system is up and running. A non-zero exit code indicates that it wants to run in foreground and the check program is invoked. A zero exit code indicates that it is able to run later in background and just a deferred message is printed. -B Run in background mode. The check program for each file system is invoked with the -F flag to determine whether it wishes to run as part of the boot up sequence, or if it is able to do its job in background after the system is up and running. A non-zero exit code indicates that it wanted to run in foreground which is assumed to have been done, so the file system is skipped. A zero exit code indicates that it is able to run in background so the check program is invoked with the -B flag to indicate that a check on the active file system should be done. When running in background mode, only one file system at a time will be checked. Note that back- ground fsck is limited to checking for only the most commonly occurring file system abnormalities. Under certain circumstances, some errors can escape background fsck. It is recommended that you perform foreground fsck on your systems periodically and whenever you encounter file-system-related panics. -t fstype Invoke fsck only for the comma separated list of file system types. If the list starts with ``no'' then invoke fsck for the file system types that are not specified in the list. -v Print the commands before executing them. -y Causes fsck to assume yes as the answer to all operator questions. -T fstype:fsoptions List of comma separated file system specific options for the specified file system type, in the same format as mount(8). FILES
/etc/fstab file system table SEE ALSO
fstab(5), fsck_ffs(8), fsck_msdosfs(8), mount(8) BSD
May 23, 2014 BSD

This post will guide you how to check your Hard Drive Health in FreeBSD operating system. How do I check my Hdds or SSDs Health using smartmontools tool from the command line in FreeBSD.

  • Smartctl Command
  • Installing Smartmontools Tool on FreeBSD
  • Checking Hard Drive Health on FreeBSD

How to Check Hard Drive Health on FreeBSD1

Smartctl Command


Smartctl controls the Self-Monitoring, Analysis and Reporting Technology (SMART) system built into most ATA/SATA and SCSI/SAS hard drives and solid-state drives. The purpose of SMART is to monitor the reliability of the hard drive and predict drive failures, and to carry out different types of drive self-tests. smartctl also supports some features not related to SMART. This version of smartctl is compatible with ACS-3, ACS-2, ATA8-ACS, ATA/ATAPI-7 and earlier standards.

You can use the forms “/dev/ad[0-9]+” for IDE/ATA devices and “/dev/da[0-9]+” or “/dev/pass[0-9]+” for SCSI devices. For SATA devices on AHCI bus use “/dev/ada[0-9]+” format. For HP Smart Array RAID controllers, use “/dev/ciss[0-9]”.

Options:

-i, --info Prints the device model number, serial number, firmware version, and ATA Standard version/revision information.

-a, --all Prints all SMART information about the disk, or TapeAlert information about the tape drive or changer.

Installing Smartmontools Tool on FreeBSD


You can use the following command to install smartmontools package on your FreeBSD, type:

$ pkg install smartmontools

Outputs:

root@freebsd:~ # pkg install smartmontools
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100% 944 B 0.9kB/s 00:01
Fetching packagesite.txz: 100% 6 MiB 2.2MB/s 00:03
Processing entries: 100%
FreeBSD repository update completed. 32770 packages processed.
All repositories are up to date.
New version of pkg detected; it needs to be installed first.
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
pkg: 1.10.5_5 -> 1.12.0

Number of packages to be upgraded: 1

The process will require 14 MiB more space.
7 MiB to be downloaded.

Proceed with this action? [y/N]:
[1/1] Fetching pkg-1.12.0.txz: 100% 7 MiB 1.7MB/s 00:04
Checking integrity... done (0 conflicting)
[1/1] Upgrading pkg from 1.10.5_5 to 1.12.0...
[1/1] Extracting pkg-1.12.0: 100%
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
smartmontools: 7.0_1

Number of packages to be installed: 1

The process will require 2 MiB more space.
499 KiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching smartmontools-7.0_1.txz: 100% 499 KiB 511.2kB/s 00:01
Checking integrity... done (0 conflicting)
[1/1] Installing smartmontools-7.0_1...
[1/1] Extracting smartmontools-7.0_1: 100%
=====
Message from smartmontools-7.0_1:

--
smartmontools has been installed

To check the status of drives, use the following:

/usr/local/sbin/smartctl -a /dev/ad0 for first ATA/SATA drive
/usr/local/sbin/smartctl -a /dev/da0 for first SCSI drive
/usr/local/sbin/smartctl -a /dev/ada0 for first SATA drive

To include drive health information in your daily status reports,
add a line like the following to /etc/periodic.conf:
daily_status_smart_devices="/dev/ad0 /dev/da0"
substituting the appropriate device names for your SMART-capable disks.

To enable drive monitoring, you can use /usr/local/sbin/smartd.
A sample configuration file has been installed as
/usr/local/etc/smartd.conf.sample
Copy this file to /usr/local/etc/smartd.conf and edit appropriately

To have smartd start at boot
echo 'smartd_enable="YES"' >> /etc/rc.conf

Once Smartmontools is installed on your FreeBSD system, and you can now use smartctl command to control and monitor SMART Disks.

Checking Hard Drive Health on FreeBSD


if you want to dispaly the hard driver disk information, and you can pass the -i option to the smartctl command, type:

$ smartctl -i /dev/ada0

Outputs:

root@freebsd:~ # smartctl -i /dev/ada0
smartctl 7.0 2018-12-30 r4883 [FreeBSD 12.0-RELEASE amd64] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model: VBOX HARDDISK
Serial Number: VBc1a25919-08b8d87a
Firmware Version: 1.0
User Capacity: 33,286,127,616 bytes [33.2 GB]
Sector Size: 512 bytes logical/physical
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ATA/ATAPI-6 published, ANSI INCITS 361-2002
Local Time is: Fri Oct 11 14:55:13 2019 UTC
SMART support is: Unavailable - device lacks SMART capability.

If you want to check hard disk health for a disk /dev/ada0 in your FreeBSD, and you can pass the -a option to the smartctl command, type:

$ smartctl -a /dev/ada0

Conclusion


You should know that how to check hard drive health using smartctl command from the command line in your FreeBSD system.


GSP


Man Pages

FSCK_FFS(8) FreeBSD System Manager’s Manual FSCK_FFS(8)

NAME

fsck_ffs, fsck_ufs

file system consistency check and interactive repair

SYNOPSIS

fsck_ffs [-BCdEFfnpRrSyZz] [-b
block] [-c
level] [-m
mode] filesystem

DESCRIPTION

The specified disk partitions and/or file systems are checked. In
«preen» or «check clean» mode the clean flag of each file
system’s superblock is examined and only those file systems that are not
marked clean are checked. File systems are marked clean when they are
unmounted, when they have been mounted read-only, or when
fsck_ffs runs on them successfully. If the
-f option is specified, the file systems will be
checked regardless of the state of their clean flag.

The kernel takes care that only a restricted class of innocuous
file system inconsistencies can happen unless hardware or software failures
intervene. These are limited to the following:

  • Unreferenced inodes
  • Link counts in inodes too large
  • Missing blocks in the free map
  • Blocks in the free map also in files
  • Counts in the super-block wrong

These are the only inconsistencies that
fsck_ffs with the -p option
will correct; if it encounters other inconsistencies, it exits with an
abnormal return status and an automatic reboot will then fail. For each
corrected inconsistency one or more lines will be printed identifying the
file system on which the correction will take place, and the nature of the
correction. After successfully correcting a file system,
fsck_ffs will print the number of files on that file
system, the number of used and free blocks, and the percentage of
fragmentation.

If sent a QUIT signal,
fsck_ffs will finish the file system checks, then
exit with an abnormal return status that causes an automatic reboot to fail.
This is useful when you want to finish the file system checks during an
automatic reboot, but do not want the machine to come up multiuser after the
checks complete.

If fsck_ffs receives a
SIGINFO (see the “status” argument for
stty(1))
signal, a line will be written to the standard output indicating the name of
the device currently being checked, the current phase number and
phase-specific progress information.

Without the -p option,
fsck_ffs audits and interactively repairs
inconsistent conditions for file systems. If the file system is inconsistent
the operator is prompted for concurrence before each correction is
attempted. It should be noted that some of the corrective actions which are
not correctable under the -p option will result in
some loss of data. The amount and severity of data lost may be determined
from the diagnostic output. The default action for each consistency
correction is to wait for the operator to respond
yes or no. If the operator
does not have write permission on the file system
fsck_ffs will default to a
-n action.

The following flags are interpreted by
fsck_ffs:

-B
A check is done on the specified and possibly active file system. The set
of corrections that can be done is limited to those done when running in
preen mode (see the -p flag). If unexpected errors
are found, the file system is marked as needing a foreground check and
fsck_ffs exits without attempting any further
cleaning.
-b
Use the block specified immediately after the flag as the super block for
the file system. An alternate super block is usually located at block 32
for UFS1, and block 192 for UFS2.

See the -N flag of
newfs(8).

-C
Check if file system was dismounted cleanly. If so, skip file system
checks (like «preen»). However, if the file system was not
cleanly dismounted, do full checks, as if fsck_ffs
was invoked without -C.
-c
Convert the file system to the specified level. Note that the level of a
file system can only be raised. There are currently four levels defined:

0
The file system is in the old (static table) format.
1
The file system is in the new (dynamic table) format.
2
The file system supports 32-bit uid’s and gid’s, short symbolic links
are stored in the inode, and directories have an added field showing
the file type.
3
If maxcontig is greater than one, build the free segment maps to aid
in finding contiguous sets of blocks. If maxcontig is equal to one,
delete any existing segment maps.

In interactive mode, fsck_ffs will
list the conversion to be made and ask whether the conversion should be
done. If a negative answer is given, no further operations are done on
the file system. In preen mode, the conversion is listed and done if
possible without user interaction. Conversion in preen mode is best used
when all the file systems are being converted at once. The format of a
file system can be determined from the first line of output from
dumpfs(8).

This option implies the -f flag.

-d
Enable debugging messages.
-E
Clear unallocated blocks, notifying the underlying device that they are
not used and that their contents may be discarded. This is useful for
filesystems which have been mounted on systems without TRIM support, or
with TRIM support disabled, as well as filesystems which have been copied
from one device to another.

See the -E and
-t flags of
newfs(8),
and the -t flag of
tunefs(8).

-F
Determine whether the file system needs to be cleaned immediately in
foreground, or if its cleaning can be deferred to background. To be
eligible for background cleaning it must have been running with soft
updates, not have been marked as needing a foreground check, and be
mounted and writable when the background check is to be done. If these
conditions are met, then fsck_ffs exits with a
zero exit status. Otherwise it exits with a non-zero exit status. If the
file system is clean, it will exit with a non-zero exit status so that the
clean status of the file system can be verified and reported during the
foreground checks. Note that when invoked with the
-F flag, no cleanups are done. The only thing that
fsck_ffs does is to determine whether a foreground
or background check is needed and exit with an appropriate status
code.
-f
Force fsck_ffs to check ‘clean’ file
systems when preening.
-m
Use the mode specified in octal immediately after the flag as the
permission bits to use when creating the
lost+found directory rather than the default 1777.
In particular, systems that do not wish to have lost files accessible by
all users on the system should use a more restrictive set of permissions
such as 700.
-n
Assume a no response to all questions asked by
fsck_ffs except for
CONTINUE?’, which is assumed to be
affirmative; do not open the file system for writing.
-p
Preen file systems (see above).
-R
Instruct fsck_ffs to restart itself if it encounters certain errors that
warrant another run. It will limit itself to a maximum of 10 restarts in a
given run in order to avoid an endless loop with extremely corrupted
filesystems.
-r
Free up excess unused inodes. Decreasing the number of preallocated inodes
reduces the running time of future runs of
fsck_ffs and frees up space that can allocated to
files. The -r option is ignored when running in
preen mode.
-S
Surrender on error. With this flag enabled, a hard error returned on disk
i/o will cause fsck_ffs to abort instead of
continuing on and possibly tripping over more i/o errors.
-y
Assume a yes response to all questions asked by
fsck_ffs; this should be used with great caution
as this is a free license to continue after essentially unlimited trouble
has been encountered.
-Z
Similar to -E, but overwrites unused blocks with
zeroes. If both -E and -Z
are specified, blocks are first zeroed and then erased.
-z
Clear unused directory space. The cleared space includes deleted file
names and name padding.

Inconsistencies checked are as follows:

  1. Blocks claimed by more than one inode or the free map.
  2. Blocks claimed by an inode outside the range of the file system.
  3. Incorrect link counts.
  4. Size checks:
    • Directory size not a multiple of DIRBLKSIZ.
    • Partially truncated file.
  5. Bad inode format.
  6. Blocks not accounted for anywhere.
  7. Directory checks:
    • File pointing to unallocated inode.
    • Inode number out of range.
    • Directories with unallocated blocks (holes).
    • Dot or dot-dot not the first two entries of a directory or having the
      wrong inode number.
  8. Super Block checks:
    • More blocks for inodes than there are in the file system.
    • Bad free block map format.
    • Total free block and/or free inode count incorrect.

Orphaned files and directories (allocated but unreferenced) are,
with the operator’s concurrence, reconnected by placing them in the
lost+found directory. The name assigned is the inode
number. If the lost+found directory does not exist,
it is created. If there is insufficient space its size is increased.

The full foreground fsck_ffs checks for
many more problems that may occur after an unrecoverable disk write error.
Thus, it is recommended that you perform foreground
fsck_ffs on your systems periodically and whenever
you encounter unrecoverable disk write errors or file-system-related
panics.

FILES

/etc/fstab
contains default list of file systems to check.

EXIT
STATUS

The fsck_ffs utility exits 0 on success,
and >0 if an error occurs.

Specific non-zero exit status values used are:

1
Usage error (missing or invalid command arguments).
2
The -p option was used and a
SIGQUIT was received, indicating that the system
should be returned to single user mode after the file system check.
3
The file system superblock cannot be read. This could indicate that the
file system device does not exist or is not yet ready.
4
A mounted file system was modified; the system should be rebooted.
5
The -B option was used and soft updates are not
enabled on the file system.
6
The -B option was used and the kernel lacks needed
support.
7
The -F option was used and the file system is
clean.
8
General error exit.
16
The file system could not be completely repaired. The file system may be
able to be repaired by running fsck_ffs on the
file system again.

DIAGNOSTICS

The diagnostics produced by fsck_ffs are fully
enumerated and explained in Appendix A of
Fsck — The UNIX File System Check
Program
.

SEE
ALSO

fs(5),
fstab(5),
fsck(8),
fsdb(8),
newfs(8),
reboot(8)

HISTORY

A fsck utility appeared in
4.0BSD. It became fsck_ffs in
FreeBSD 5.0 with the introduction of the filesystem
independent wrapper as fsck.


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.

Понравилась статья? Поделить с друзьями:
  • Проверить диск на ошибки chkdsk и исправить
  • Проверить диск ext4 на ошибки
  • Проверить джава код на ошибки
  • Проверить выборку на наличие грубых ошибок
  • Проверить вордовский файл на орфографические ошибки