Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
alpine
alpine-conf
Commits
a8e3f8ca
Commit
a8e3f8ca
authored
Nov 07, 2011
by
Natanael Copa
Browse files
setup-disk: fix compaq server disk arrays /dev/cciss/c0d0 style disks
parent
f236951e
Changes
1
Hide whitespace changes
Inline
Side-by-side
setup-disk.in
View file @
a8e3f8ca
...
...
@@ -292,7 +292,8 @@ find_swap_size() {
local
size
=
$((
$memtotal_kb
*
2
/
1024
))
local
disk
=
disksize
=
for
disk
in
$@
;
do
local
sysfspath
=
/sys/block/
${
disk
#/dev/
}
/size
local
sysfsdev
=
$(
echo
${
disk
#/dev/
}
|
sed
's:/:!:g'
)
local
sysfspath
=
/sys/block/
$sysfsdev
/size
# disksize = x * 512 / (1024 * 1024) = x / 2048
# maxsize = $disksize / 4 = x / (2048 * 4) = x / 8192
maxsize
=
$(
awk
'{ printf "%i", $0 / 8192 }'
$sysfspath
)
...
...
@@ -312,11 +313,12 @@ find_swap_size() {
has_mounted_part
()
{
local
p
local
sysfsdev
=
$(
echo
${
1
#/dev/
}
|
sed
's:/:!:g'
)
# parse /proc/mounts for mounted devices
for
p
in
$(
awk
'$1 ~ /^\/dev\// {gsub("/dev/", "", $1); print $1}'
\
for
p
in
$(
awk
'$1 ~ /^\/dev\// {gsub("/dev/", "", $1);
gsub("/", "!", $1);
print $1}'
\
/proc/mounts
)
;
do
[
"
$p
"
=
"
$
1
"
]
&&
return
0
[
-e
/sys/block/
$
1
/
$p
]
&&
return
0
[
"
$p
"
=
"
$
sysfsdev
"
]
&&
return
0
[
-e
/sys/block/
$
sysfsdev
/
$p
]
&&
return
0
done
return
1
}
...
...
@@ -376,11 +378,12 @@ init_progs() {
show_disk_info
()
{
local
disk
=
vendor
=
model
=
d
=
size
=
for
disk
in
$@
;
do
d
=
${
disk
##*/
}
local
dev
=
${
disk
#/dev/
}
d
=
$(
echo
$dev
|
sed
's:/:!:g'
)
vendor
=
$(
cat
/sys/block/
$d
/device/vendor 2>/dev/null
)
model
=
$(
cat
/sys/block/
$d
/device/model 2>/dev/null
)
size
=
$(
awk
'{gb = ($1 * 512)/1000000000; printf "%.1f GB\n", gb}'
/sys/block/
$d
/size 2>/dev/null
)
echo
"
$d
(
$size
$vendor
$model
)"
echo
"
$d
ev
(
$size
$vendor
$model
)"
done
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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