Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-admin-essentials
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etersoft-admin-essentials
Commits
3927adcd
Commit
3927adcd
authored
Mar 23, 2018
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix_disk.sh: updated
parent
bff62d42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
fix_disk.sh
hdd/fix_disk.sh
+16
-9
No files found.
hdd/fix_disk.sh
View file @
3927adcd
...
...
@@ -32,8 +32,8 @@ test_block()
fix_block
()
{
DEV
=
$1
block
=
$2
local
DEV
=
$1
local
block
=
$2
# FIXME: possible badblocks always returns true
# badblocks -b 512 -v -s $DEV $block $block && { echo "Already OK, skipped..." ; [ -z "$FORCE" ] && return ; }
test_block
$DEV
$block
&&
{
echo
"Already OK, skipped..."
;
[
-z
"
$FORCE
"
]
&&
return
;
}
...
...
@@ -59,27 +59,34 @@ fix_block()
#BLOCKLIST=
#Buffer I/O error on device sda, logical block 32607659
dmesg |
grep
"logical block "
|
sed
-e
"s|.*Buffer I/O error on dev.*
\(
sd[a-z][0-9]*
\)
, logical block
\(
[0-9]*
\)
|
\1
\2
|g"
|
sort
-u
|
\
#dmesg | grep "device sd[a-z], logical block " | sed -e "s|.*Buffer I/O error on device \(sd[a-z]\), logical block \([0-9]*\)|\1 \2|g" | sort -u | \
#echo |
while
read
devname block
;
do
#for i in $BLOCKLIST ; do
echo
#FIXME: logical block - 8 sectors (on 64 bit) or 4 sectors (on 32 bit?)
echo
"Logical bad block
$block
on /dev/
$devname
..."
#echo "Fixing $block block on /dev/$devname ..."
#fix_block /dev/$devname $block
echo
"List
$block
bad block on /dev/
$devname
..."
if
[
-z
"
$LIST
"
]
;
then
echo
"Fixing
$block
block (* 4 + 0...4) on /dev/
$devname
..."
fix_block /dev/
$devname
$((
$block
*
4
+
0
))
fix_block /dev/
$devname
$((
$block
*
4
+
1
))
fix_block /dev/
$devname
$((
$block
*
4
+
2
))
fix_block /dev/
$devname
$((
$block
*
4
+
3
))
fi
done
# [23743.306922] blk_update_request: critical medium error, dev sdc, sector 510634067
# [ 6.934350] blk_update_request: I/O error, dev sda, sector 16780432
dmesg |
grep
-E
"(blk_update_request|end_request): (critical medium error|I/O error)"
|
sed
-e
"s|.*, dev
\(
sd[a-z]
\)
, sector
\(
[0-9]*
\)
|
\1
\2
|g"
|
sort
-u
|
\
while
read
devname
block
;
do
while
read
devname
sector
;
do
#for i in $BLOCKLIST ; do
echo
if
[
-n
"
$LIST
"
]
;
then
echo
"Error with sector
$
block
on /dev/
$devname
..."
echo
"Error with sector
$
sector
on /dev/
$devname
..."
else
echo
"Fixing
$
block
block
on /dev/
$devname
..."
fix_block /dev/
$devname
$
block
echo
"Fixing
$
sector
sector
on /dev/
$devname
..."
fix_block /dev/
$devname
$
sector
fi
done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment