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
4924227d
Commit
4924227d
authored
Dec 04, 2019
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
print_disks.sh: print drive info
parent
4bbfa5a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
functions.sh
hdd/functions.sh
+14
-0
print_disks.sh
hdd/print_disks.sh
+1
-1
No files found.
hdd/functions.sh
View file @
4924227d
...
...
@@ -27,6 +27,20 @@ print_dev_type()
is_hdd
"
$1
"
&&
echo
"HDD"
||
echo
"SSD"
}
# file field
# Example: /tmp/lala "Serial Number"
get_smart_field
()
{
cat
"
$1
"
|
grep
"
$2
: "
|
tail
-n1
|
sed
-e
"s/.*
$2
: *//g"
}
print_drive_info
()
{
local
TF
=
$(
mktemp
)
smartctl
-i
$1
>
$TF
echo
"Model:
$(
get_smart_field
$TF
"Model Family"
)
$(
get_smart_field
$TF
"Device Model"
)
Serial:
$(
get_smart_field
$TF
"Serial Number"
)
Firmware:
$(
get_smart_field
$TF
"Firmware Version"
)
"
rm
-f
$TF
}
# https://unix.stackexchange.com/questions/65595/how-to-know-if-a-disk-is-an-ssd-or-an-hdd
# lsblk -d -o name,rota
...
...
hdd/print_disks.sh
View file @
4924227d
...
...
@@ -51,7 +51,7 @@ for i in $PHYSORDER ; do
health
$DEV
||
echo
"NACCESS to
$DEV
"
MD
=
"
$(
print_md
$DEV
)
"
# TYPE SIZE DEV SERIAL MD
printf
"%3s %7s %-10s %4s %10s
\n
"
"
$(
print_dev_type
$DEV
)
"
"
$(
print_size
$DEV
)
"
"
$DEV
"
"
$(
print_serno
$DEV
)
"
"
$MD
"
printf
"%3s %7s %-10s %4s %10s
%s
\n
"
"
$(
print_dev_type
$DEV
)
"
"
$(
print_size
$DEV
)
"
"
$DEV
"
"
$(
print_serno
$DEV
)
"
"
$MD
"
"
$(
print_drive_info
$DEV
)
"
if
[
-z
"
$MD
"
]
;
then
for
pd
in
$DEV
*
;
do
MD
=
"
$(
print_md
$pd
)
"
...
...
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