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
68135b84
Commit
68135b84
authored
Nov 25, 2018
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hdd/functions.sh: check sectors
parent
460c802a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
functions.sh
hdd/functions.sh
+4
-0
No files found.
hdd/functions.sh
View file @
68135b84
...
...
@@ -9,6 +9,8 @@ is_hdd()
#hdparm -i "$1" | grep -q "Model=WDC"
local
drive
=
"
$(
basename
$dev
)
"
[
-d
"/sys/block/
$drive
"
]
||
return
0
# since 2.6.29
rot
=
"
$(
cat
/sys/block/
$drive
/queue/rotational
)
"
[
"
$rot
"
=
"1"
]
...
...
@@ -33,6 +35,7 @@ print_size()
local
dev
=
"
$1
"
local
sectors
sectors
=
"
$(
hdparm
-i
$dev
|
grep
"LBAsects="
|
sed
-e
"s|.*LBAsects=
\(
.*
\)
|
\1
|"
)
"
#"
[
-n
"
$sectors
"
]
||
{
echo
"No info"
;
return
;
}
# other method:
#sectors="$(blockdev --getsz $dev)"
echo
"
$((
$sectors
/
2
/
1024
/
1024
))
GB"
...
...
@@ -44,5 +47,6 @@ print_partsize()
local
sectors
local
drive
=
"
$(
basename
$dev
)
"
sectors
=
"
$(
cat
/sys/class/block/
$drive
/size
)
"
[
-n
"
$sectors
"
]
||
{
echo
"No info"
;
return
;
}
echo
"
$((
$sectors
/
2
/
1024
/
1024
))
GB"
}
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