Remount /dev/shm if the size is changed
authorTom Hughes <tom@compton.nu>
Thu, 14 Nov 2019 20:43:55 +0000 (20:43 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 14 Nov 2019 20:43:55 +0000 (20:43 +0000)
cookbooks/hardware/recipes/default.rb

index 454386459ce800658b4cd5fe571fdc8214ed4354..110273d82cfc68bfffc82dbbff6281920776ff74 100644 (file)
@@ -537,10 +537,18 @@ unless Dir.glob("/sys/class/hwmon/hwmon*").empty?
 end
 
 if node[:hardware][:shm_size]
+  execute "remount-dev-shm" do
+    action :nothing
+    command "/bin/mount -o remount /dev/shm"
+    user "root"
+    group "root"
+  end
+
   mount "/dev/shm" do
-    action [:mount, :enable]
+    action :enable
     device "tmpfs"
     fstype "tmpfs"
     options "rw,nosuid,nodev,size=#{node[:hardware][:shm_size]}"
+    notifies :run, "execute[remount-dev-shm]"
   end
 end