Hard disk rewiring on Linux. Rechecking a robot disk in Ubuntu Rechecking a disk in Ubuntu 16.04

Golovna / Zahist

Did you tell Linus Torvalds, creating his own brainchild, that Linux will win in budding systems, and not only in cheap home routers, but also in such serious telecom solutions like AVAYA PBX?

Not long ago I had a chance to celebrate the success of ATS AVAYA of one great Zamovnik. The same Avaya G650 (chasі) gateway with an Avaya S8400 server (processor). De yak the system disk is recovered from a CompactFlash with a capacity of 2 GB. It is smartly possible to use an SSD disk with an IDE interface.
Well, it was my surprise, if I connected the CF accumulator through a card reader, I got to know the structure of the Linux file system. Which, obviously, facilitated the procedure for re-verification of the CF accumulative praxis.

How to rewrite the Linux file system disk for pardon

In the MicroSoft DOS operating system (that's the way, I remember version 5.0, as it was on one floppy disk!) there was a CHKDSK disk rechecking command. І schos similar є і in Linux.
To check a Linux disk for file system pardons, you need to specify the names of the file systems to check:

# df -h Filesystem Size Hardwired %% Mounted on /dev/sda 20G 4.0G 15G 21% / /dev/sdd1 1G 455M 555M 46% /media/Np%blsl3648B4Jjeiedgyy /de1/d0 10.13-23dd none 246M 0 246M 0 %/dev/shm

For accumulative CF, which is being tested, - tse /dev/sdd1і /dev/sdd6
Next, it is necessary to unmount the file systems that are being tested:

#sudo umount /dev/sdd1 #sudo umount /dev/sdd6

#fsck -y /dev/sdd1 #fsck -y /dev/sdd6

Parameter -y You will automatically be informed yes on all meals, that as a rule more coristuvachiv and rob.

Results of the Lunux FSCK Filesystem Recheck Utility

In my opinion, on one of the distributions, there were pardons, which the utility corrected. After that CF accumulators turned to their place and Avaya PBX implementation was renewed.

by Admin

Let's take a look at the ways of re-checking and diagnosing hdd in linux systems. Information about the HDD robot will help to analyze the mill and, if necessary, replace the broken nose, thereby preventing the system from crashing or causing damage. Dodatkovo fastened carefully for smart HDD to our zabbix monitoring system

We remove the list of connected storage devices from the system

For vyznachennya, where and where mounted, vikonaemo

See if you can find a place for something else that accumulates

Like a soft ride

[email protected]:~# cat /proc/mdstat
Personalities:
md1: active raid1 sdb3 sda3
965888832 blocks super 1.2

md0: active raid1 sdb1 sda1
9756544 blocks super 1.2
unused devices:
[email protected]:~#

what kind of raid insertion (removal)
md0- naming the add-on raid
sda sdb- upgraded outbuildings in denmark raid
- stan disks in RAID arrays

Install required packages

aptitude install hdpparm sysstat smartmontools

We were amazed at the speed of reading from the accumulated

For help iostat(at the sysstat warehouse) we analyze the traffic on our HDD

Seeing data on all disks with an interval of 10 seconds.

You can designate the accumulator for analysis by adding

For the help of this utility, there is a significant interest in our outbuildings, the statistics of the introduction / implementation and the hundredth utilization.

avg-cpu: %user %nice %system %iowait %steal %idle
0,16 0,00 1,89 23,75 0,00 74,21

I will become accumulative

For the cob, we will check our HDD for the presence of bad blocks, in times of consumption, it is visible that it is significant for ignoring.

badblocks /dev/sda3 -sv > /root/badblockSDA3
Checking for bad blocks (read-only test): 27.93% done, 36:12 elapsed. (0/0/0 errors)

/dev/sda3- I'll add what is being revised
s- Visnovok percentage information
v- turn on report mode
> /root/badblockSDA3- write zbіyni sectors of the file

Bad block icon (marked blocks will be ignored by the system):

e2fsck -l /root/badblockSDA3 /dev/sda3

Bad blocks are identified, you can work with the disk.

ATTENTION!!! This operation is due to be carried out on an unmounted nose or in read-only mode

ATTENTION!!! Perevіreny attachments and attachments, on whom the broken blocks will rush, may be one and the same!

We take S.M.A.R.T data about the HDD robot

De /dev/sdX - I'll add it, it's necessary to revise it.
You take into account the attributes of S.M.A.R.T., the meaning of the skin is well described on the wiki

S.M.A.R.T monitoring for hard drives in Zabbix

For skin problems accumulating SMART

[email protected]:~# smartctl -i /dev/sda |grep SMART
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
[email protected]:~#

If it is supported, if it is not included, then it is included

smartctl -s on -S on -o on /dev/sda

we check the status with the command

smartctl -H /dev/sda |grep "test"| cut -f2 -d: |tr -d " "

[email protected]:/etc/zabbix# smartctl -H /dev/sda |grep "test"| cut -f2 -d: |tr -d " "
PASSED
[email protected]:/etc/zabbix#

In the configuration file of the zabbix agent agent, the smart recheck parameter for the disk is enabled

UserParameter=HDD_smart.[*],sudo smartctl -H /dev/$1 |grep "test"| cut -f2 -d: |tr -d " "

de HDD_smart- key for zabbix element

in sudoers add record

zabbix ALL=NOPASSWD:/usr/sbin/smartctl

restart sudo and zabbix agent.

To be sure of the correctness, we will log in under zabbix to be correct, which is corrected by our team

[email protected]:/etc/zabbix# su - zabbix -s /bin/bash
The directory is not available daily, access to the system is disabled from HOME=/
zabbix [email protected]:/$ sudo smartctl -H /dev/sda |grep "test"| cut -f2 -d: |tr -d " "
PASSED
[email protected]:/$

On the zabbix server we create zabbix agent ( active) danih element

Im'ya- more
Type of- Zabbix agent (Active)
Key- HDD_Smart. - for the first disk, for the other it's different.
Type of- Symbol

І in a deyaky hour, we will be sure to give

A bad hard drive is one of the worst things a robot computer has to offer. Not only that, we can easily spend a lot of important information and files, so replacing the HDD is not weak on the budget. Dodamo before this stained glass often that nerves, like, like, like, do not get inspired. In order not to give problems, catch us knowing and zazdalegіd diagnosing, warto nobility, how to turn a hard disk into pardons in Ubuntu OS. Programming benefits that give such services are enough.

Yak Ubuntu protest hard drive for pardon.

Let's download the software neobov'yazkovo, so that we can check the disc in Ubuntu. The operating system already has the utility as it is recognized for that job. It is called badblocks, it is requested through the terminal.

Open the terminal and enter:

This command displays information about all HDDs, like a victorious system.

After that, we enter:

sudo badblocks -sv /dev/sda

The command is to serve for the search of poor sectors. Replace /dev/sda is entered by the name of the accumulator. The -s and -v switches are used to display in the correct order the headers of the recheck blocks (s) and to see the sound of all the blocks (v).

Pressing the keys Ctrl + C mi zupinaєmo reverification of the hard disk.

To control the file system, you can also twist two other commands.

In order to unmount the file system, enter:

For re-verification and correction of pardons:

sudo fsck -f -c /dev/sda

  • "-f" to start the primus process, to carry out yoga, to set as HDD values ​​as practical;
  • -c know and designate bad blocks;
  • "-y" - additional argument, which immediately says Yes on all power systems. You can enter "-p" instead of a new one, you will perform the verification in automatic mode.

Programs

Dodatkove software security also miraculously copes with this function. And sometimes it’s better. Tim is bigger, it’s easier for deaky coristuvaches to work with a graphical interface.

GParted itself is for quiet, to whom a text interface is not up to par. The utility overcomes the great number of problems connected with the HDD robot on Ubuntu. Before them enter and recheck the disk for pardon.

For the cob, we need to get GParted installed. Let's enter the command to get started from the official repositories:

sudo apt-get install gparted

  1. Open the program. All noses are displayed on the head screen. If any of these meanings are familiar to the call, it means that it’s not so with him.
  2. Click on that disk, whichever you want to revise.
  3. Tisnemo on the “Spawned” button, I’ll stash the beast.
  4. We choose "Checking for pardons."

The program scans the disk. Zalezhno vіd yogo obyagu, the process can go longer or less. After scanning, we will be informed about the results of yoga.

This is already a foldable utility, as it means more serious rechecking of the HDD for different parameters. Like the last, the kerubate is also more folding. The graphical interface of Smartmontools is not forwarded.

We download the program:

aptitude install smartmontools

We wonder if we have accumulated connections to our system. It is necessary to give respect to rows that will end with a letter, but not with a number. The same rows have information about disks.

ls-l/dev | grep -E 'sd|hd'

We drive in a team to see the report information about the wear. Varto marvels at the ATA option. On the right, when replacing a hard drive, it's better to add attachments to this great ATA. This is how you can expand your yoga ability to the maximum. And also look and remember the SMART parameters.

smartctl -info /dev/sde

Let's start a review. If SMART is supported, then add "-s". Likewise, wines are not supported, but other than inclusions, the whole argument can be taken away.

smartctl -s on -a /dev/sde

For this reason, we marvel at the information under READ SMART DATA. The result can take two values: PASSED or FAILED. As soon as the rest is gone, you can start working on backup copies and replace the hard drive.

Programs do not exhaust the possibility of this. Ale for a one-time re-verification of the HDD, which will be enough.

safecopy

Tse is the same program, as you can score on the ship's tone. As we know that something is wrong with our disk, and we aim to vryatuvat more files that survived, then Safecopy will come to the rescue. Її zavdannya itself polygaє at the copying of data from poshkodzhenikh noses. And why won't you take files from broken blocks.

Install Safecopy:

sudo apt install safecopy

Transferring files from one directory to another. Vibrati can be-yaku іnshu. In my case, we transfer data from the sda ​​disk to the home folder.

sudo safecopy /dev/sda /home/

Bed blocks

Some people can be blamed for this: "what are these blocks and stink stars on my HDD, why have I never chipped one?" Bad blocks, or the bad sectors - divided the HDD, which is no longer readable. At every time, so the stench of objective reasons was recognized by the file system. And it’s better for everything, with a disk in these places, it’s not right. "Bedi" sound like on old hard drives, and on the most modern ones, the stink shards practically work behind these very technologies.

Z'yavlyayutsya w zbіynі sectors of rіznih reasons.

  • Rereading the record through vimknennya living. All the information that comes on the hard drive is broken up by seeing ones and zeros on different parts. To beat this process means to greatly confuse the Winchester.
  • Neakіsne folded. Nothing to say here. I can fly at a cheap Chinese one.

Now you know how to scan HDD for pardon. Rechecking the disk like on Ubuntu, and on other systems, do an important operation, if you want to perform a wart once on the river.

Even if you don't want to shut up at your operating system, then the cost of not getting out of the way of hard disks. For additional backup and RAID protection technology, you can even turn all the data on the spot, but the cost of the hardware add-on can also be found on the budget, especially since you didn’t plan to do this.

To get rid of such problems, you can hack smartmontools. This is a software package for managing and monitoring attachments and collecting data for the additional technology of Self-Monitoring Analysis and Reporting Technology, or simply SMART.

Most of today's ATA/SATA, SCSI/SAS accumulated information provides a SMART interface. Meta SMART - monitoring of hard disk pressure, for the manifestation of various pardons and timely response to their appearance. Smartmontools consists of two utilities - smartctl and smartd. At the same time, the stink is an attempt to monitor the monitoring system and that there is a warning about the possibility of HDD failures in Linux. Next, we will review in detail the revision of the linux hard drive.

The smartmontools package is in the official repositories of most Linux distributions, so it is installed before one command is written. On Debian, on systems that are based on New, see:

aptitude install smartmontools

And for Red Hat:

yum install smartmontools

Now you can move on to linux hard disk diagnostics.

Hard disk remapping in smartctl

Quickly find out which hard disks are connected to your system:

ls-l/dev | grep -E "sd|hd"

Visnovka will have something similar:

Here - sdx - I'll add an HDD connected to the computer.

To display information about a specific hard disk (attach model, S/N, firmware version, ATA version, SMART interface availability) Run smartctl with the info option and hard disk name. For example, for /dev/sda:

smartctl --info /dev/sda

If you don't want to worry about the ATA version, it's one of the most important factors when trying to replace an add-on. Skin new version of ATA is the same as the previous ones. For example, the old ATA-1 and ATA-2 extensions will miraculously work on ATA-6 and ATA-7 interfaces, but not the other way around. If I add the ATA version to that interface, it will not be possible to open it again. In this case, it is better to choose a hard disk ATA-7 for replacement.

You can run the hard drive ubuntu hard drive with the command:

smartctl -s on -a /dev/sda

Here is an option -s avenge the ensign SMART on the vkazivny outbuilding. You can clean it up, as the SMART support is already included. Information about the disc is divided into sprats. READ SMART DATAє general information about the health of the hard disk.

START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment rest result: PASSED

This test can be passed ( PASSED) chi ni ( FAILED). In the rest of the day, the failure is inevitable, start backing up the data from this disk.

Come on, you can wonder if you need HDD diagnostics in linux, the SMART attribute table.

The SMART table has the parameters assigned for a particular disk by the retailer, as well as the input threshold for these parameters. The table is automatically loaded and updated based on the disk firmware.

  • ID #- ID attribute, as a rule, tenth number between 1 and 255;
  • ATTRIBUTE_NAME- naming an attribute;
  • FLAG- Ensign to the attribute;
  • VALUE- this field is normal for this attribute in the range from 1 to 253, 253 - shortest standard, 1 - higher. Fallow in the vіd vіd vіd vіdnosti vіd vіd 100 to 200;
  • WORST- the highest value for the whole hour;
  • THRESH- the lowest value, after the transition for some reason it is necessary to remind that the disk is unsuitable for operation;
  • TYPE- attribute type, possibly Pre-fail or Old_age. All standard attributes are considered critical, so if the disk did not pass the revalidation for one of the attributes, then VIN is already considered FAILED, but the old_age attributes are not critical;
  • UPDATED- Specify the frequency of attribute updates;
  • WHEN_FAILED- will be set to FAILING_NOW if the attribute value is less or more than THRESH, or "-" is more. The FAILING_NOW viewport is more likely to have a backup copy, especially as the Pre-fail attribute type.
  • RAW_VALUE- Significance, appointed by the virobnik.

Now you think that smartctl is a good tool, but I don't have the ability to run it manually, it would be bad to automate everything on the right, so that the program runs periodically and informs me about the results of the check. І tse possible for help smartd.

Setting up smartd and smartctl for real-time diagnostics and monitoring

Diagnostics of hdd in linux in real time is even easier. Edit the smartd configuration file - /etc/smartd.conf. Add the next row:

nano /etc/smartd.conf

/dev/sda-m [email protected]-M test

  • -m - e-mail addresses for verification results verification. It is possible to have the address of a local koristuvach, a superkoristuvach, or a zovnіshnu address, as a server has been set up for the oversight of electronic mail;
  • -M- Frequency of overstrength of leaves. once - more than one reminder about disk problems. daily- nadsilati podomlennya schodnya akshcho the problem was revealed. diminishing- nadsilati podomlennya in a day, as if the problem was revealed. test- nadsilat test podomlennya pіd hour start smartd. exec- I have appointed the program in the office of the administration post.

Save changes and restart smartd. You are responsible to e-mail the following sheet:

You can also schedule tests on your own schedule, for which you can select the -s option and a regular test like "T/MM/DD/DN/HH", de:

  • T- Test type:
  • L- Long test;
  • S- short test;
  • C- Transfer test (ATA);
  • O- offline (test).

Other characters indicate the date and hour of the test:

  • MM- a month on the river;
  • DD- Day of the month;
  • HH- One o'clock;
  • DN- day of Monday (day 1 - Monday 7 - week;
  • MM, DD and HH- Specify from two tenth digits.

Krapka means all possible values, viraz at the arms (A|B|C) - means one of three options, viraz at the square arms means a range (type 1 to 5).

For example, in order to re-verify the linux hard disk of the skin working day for the day, add the next row to smartd.conf:

DEVICESCAN -s (L/../..//13)

Visnovki

If you want to quickly override the mechanical work of a hard disk, look over its physical state, or swipe larger-smaller around the surface of the disk, use smartmontools. Don't forget to check your regular scans, then you'll check back. Have you already worked before? Robitimete? What are the other methods? Write in the comments!

Dzherelo translate.

As soon as the operating system is busy, it will tell you about pardons in the file system on one of the distributions, then wart negligently reverse the disks and correct the pardons of the file system.

If any self-respecting coristuvach is not guilty of forgetting that the periodic rechecking of hard disks on bit sectors and that rechecking of disks for pardons is the butt of a healthy eye.

Important! Run ta vikonannya FSCK on the mounting file system, you can bring it to a halt,quote this material for your own fear and risk. The author did not bear the responsibility for being beaten, so that you can win.

In order to protect yourself, you must:

  • Switch to Single user mode and unmount the file system
  • Get the computer in the wake-up mode for an additional CD

Also, it is necessary to rewrite the disks and fix the pardons of the file system, for good reason.

1) Single user mode

Change the date of initialization unmount the filesystem:

# init 1
# mount /home

Click on the link for the connected distributions:

# fsck /dev/sda1

2) Renewal mode from CD.

Insert the CD into the drive and reboot the system:

Check the current hour and after downloading from the installation CD, enter the command:

# linux rescue nomount

The NOMOUNT directive is to hedge the mount, so you can safely hack the FSCK.

The next time you run FSCK to distribute pardons:

# fsck -yvf /dev/sda1

LVM (Logical Volume Manager)

Situation h LVM (Logical Volume Manager) split the troch more folded. For launch FSCK for LVM it is necessary to know PV (Physical Volume), VG (Volume Group), LV (Logical Extension) that activate їх, for which type the following commands in sequence:

# lvm pvscan
# lvm vgscan
# lvm lvchange -ay VolGroup00
# lvm lvscan

# fsck -yfv /dev/VolGroup00/LogVol00

Behind the fact that FSCK has changed, turn the result of looking at the code, this code is a unique number, which becomes the sum of the offensive values:

0 - No pardons (No errors);
1 - Corrected file system pardons (Filesystem errors correctod);
2 - System should be rebooted;
4 - Filesystem errors left uncorrected;
8 - Operational pardon (Operational error);
16 - Pardons when vikoristanny or syntactic pardons (Usage or syntax error);
32 - Fsck canceled by user request;
128 – Pardon of the global library (Shared-library error).

© 2022 androidas.ru - All about Android