Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
67e49aba
Commit
67e49aba
authored
Jul 11, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rc: enable TRIM for GPT/UFS labels too; closes #1055
parent
3284b185
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
12 deletions
+26
-12
rc
src/etc/rc
+26
-12
No files found.
src/etc/rc
View file @
67e49aba
...
...
@@ -28,19 +28,33 @@ while read FS_PART FS_MNT FS_TYPE FS_MORE; do
continue
;
fi
# enables soft updates
tunefs
-n
enable
${
FS_MNT
}
# enables TRIM
FS_DEV
=
$(
echo
${
FS_PART
}
|
awk
'match($0, /\/dev\/([a-z]+[0-9]+)/) { print substr( $0, RSTART, RLENGTH )}'
)
FS_TRIM
=
$(
camcontrol identify
${
FS_DEV
}
|
grep
TRIM |
awk
'{ print $5; }'
)
if
[
"
${
FS_TRIM
}
"
=
"yes"
]
;
then
# appending "# notrim" to the /etc/fstab entry
if
echo
"
${
FS_MORE
}
"
|
grep
-iq
nosoft
;
then
# appending "# nosoft" to the /etc/fstab entry
# will allow to strip trim and leave it disabled
if
echo
"
${
FS_MORE
}
"
|
grep
-iq
notrim
;
then
tunefs
-t
disable
${
FS_MNT
}
else
tunefs
-t
enable
${
FS_MNT
}
tunefs
-n
disable
${
FS_MNT
}
else
# enables soft updates
tunefs
-n
enable
${
FS_MNT
}
fi
FS_DEV
=
$(
echo
${
FS_PART
}
|
awk
'match($0, /^\/dev\/(gpt|ufs)\/.+$/) { print substr( $0, RSTART + 5, RLENGTH - 5 )}'
)
if
[
-n
"
${
FS_DEV
}
"
]
;
then
FS_DEV
=
$(
glabel status
-as
|
grep
${
FS_DEV
}
|
awk
'match($3, /^[a-z]+[0-9]+/) { print substr( $3, RSTART, RLENGTH )}'
)
fi
if
[
-z
"
${
FS_DEV
}
"
]
;
then
FS_DEV
=
$(
echo
${
FS_PART
}
|
awk
'match($0, /^\/dev\/[a-z]+[0-9]+/) { print substr( $0, RSTART + 5, RLENGTH - 5 )}'
)
fi
if
[
-n
"
${
FS_DEV
}
"
]
;
then
FS_TRIM
=
$(
camcontrol identify
${
FS_DEV
}
|
grep
TRIM |
awk
'{ print $5; }'
)
if
[
"
${
FS_TRIM
}
"
=
"yes"
]
;
then
if
echo
"
${
FS_MORE
}
"
|
grep
-iq
notrim
;
then
# appending "# notrim" to the /etc/fstab entry
# will allow to strip trim and leave it disabled
tunefs
-t
disable
${
FS_MNT
}
else
# enables TRIM
tunefs
-t
enable
${
FS_MNT
}
fi
fi
fi
done
< /etc/fstab
...
...
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