Skip to content

Commit

Permalink
mount/chef was not working as expected; moved noatime to sed to have …
Browse files Browse the repository at this point in the history
…it working for now
  • Loading branch information
mdxp committed Sep 6, 2010
1 parent a6d7e34 commit f5d2e11
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion noatime/metadata.json
Expand Up @@ -18,7 +18,7 @@
"platforms": {
},
"license": "Apache 2.0",
"version": "0.1.0",
"version": "0.2.0",
"conflicting": {
},
"name": "noatime",
Expand Down
2 changes: 1 addition & 1 deletion noatime/metadata.rb
Expand Up @@ -3,5 +3,5 @@
license "Apache 2.0"
description "Enables noatime on all mounted disks"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.1"
version "0.2.0"

25 changes: 18 additions & 7 deletions noatime/recipes/default.rb
Expand Up @@ -18,11 +18,22 @@
# limitations under the License.
#

node[:filesystem].keys.select { |k| k =~ /\A\/dev\// }.map do |d|
mount "#{node[:filesystem][d][:mount]}" do
device "#{d}"
fstype "#{node[:filesystem][d][:fs_type]}"
options node[:filesystem][d][:mount_options] << "noatime"
action [:enable]
end
#node[:filesystem].keys.select { |k| k =~ /\A\/dev\// }.map do |d|
# mount "#{node[:filesystem][d][:mount]}" do
# device "#{d}"
# fstype "#{node[:filesystem][d][:fs_type]}"
# options node[:filesystem][d][:mount_options] << "noatime"
# action [:enable]
# end
#end

## Unfortunately the above method is not working as expected, so I'll have to use sed to modify fstab directly
## Note: it will not remount the filesystems and only change fstab.

bash "enable noatime" do
code <<-EOH
sed -i -e '/noatime\\|noauto\\|swap\\|proc\\|nfs\\|^#/ !s/defaults\\|remount-ro/&,noatime/g' /etc/fstab
EOH
only_if "grep -v 'noatime\\|noauto\\|swap\\|proc\\|nfs\\|^#' /etc/fstab"
end

0 comments on commit f5d2e11

Please sign in to comment.