Revision 29aef439
Added by Jim Pingle over 5 years ago
src/etc/pfSense-rc | ||
---|---|---|
168 | 168 |
fi |
169 | 169 |
fi |
170 | 170 |
|
171 |
USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar) |
|
172 |
|
|
173 |
unset MOVE_PKG_DATA |
|
174 |
# If use MFS var is disabled, move files back to place |
|
175 |
if [ "${USE_MFS_TMPVAR}" != "true" -a -f /root/var/db/pkg/local.sqlite ]; then |
|
176 |
MOVE_PKG_DATA=1 |
|
177 |
rm -rf /var/db/pkg 2>/dev/null |
|
178 |
rm -rf /var/cache/pkg 2>/dev/null |
|
179 |
mv -f /root/var/db/pkg /var/db |
|
180 |
mv -f /root/var/cache/pkg /var/cache |
|
181 |
# If use MFS var is enabled, move files to a safe place |
|
182 |
elif [ "${USE_MFS_TMPVAR}" = "true" -a -f /var/db/pkg/local.sqlite ]; then |
|
183 |
MOVE_PKG_DATA=1 |
|
184 |
rm -rf /root/var/db/pkg 2>/dev/null |
|
185 |
rm -rf /root/var/cache/pkg 2>/dev/null |
|
186 |
/bin/mkdir -p /root/var/db /root/var/cache |
|
187 |
mv -f /var/db/pkg /root/var/db |
|
188 |
mv -f /var/cache/pkg /root/var/cache |
|
189 |
fi |
|
190 |
|
|
191 |
# Mount /var and /tmp on ZFS filesystems when it's necessary |
|
192 |
if [ -n "${USE_ZFS}" -a "${USE_MFS_TMPVAR}" = "true" ]; then |
|
193 |
zfs list -H -o name,mountpoint | |
|
194 |
while read volume mountpoint; do |
|
195 |
[ "${mountpoint}" != "/var" -a "${mountpoint}" != "/tmp" ] \ |
|
196 |
&& continue |
|
197 |
|
|
198 |
/sbin/zfs umount ${volume} |
|
199 |
done |
|
171 |
. /etc/rc.ramdisk_functions.sh |
|
172 |
|
|
173 |
# Check if RAM disks are enabled, store for repeated use |
|
174 |
if ramdisk_check_enabled; then |
|
175 |
USE_RAMDISK=true |
|
200 | 176 |
fi |
201 | 177 |
|
202 |
if [ "${USE_MFS_TMPVAR}" = "true" ]; then |
|
178 |
# Relocate pkgdb based on desired RAM disk settings |
|
179 |
ramdisk_relocate_pkgdb_all |
|
180 |
|
|
181 |
# Dismount /tmp and /var on ZFS if using RAM disks and they are separate volumes |
|
182 |
if [ -n "${USE_ZFS}" -a -n "${USE_RAMDISK}" ]; then |
|
183 |
ramdisk_fixup_zfs |
|
184 |
fi |
|
185 |
|
|
186 |
# Attempt to create and mount RAM disks |
|
187 |
if [ -n "${USE_RAMDISK}" ]; then |
|
203 | 188 |
/etc/rc.embedded |
204 | 189 |
fi |
205 | 190 |
|
206 |
if [ -n "${MOVE_PKG_DATA}" -o "${USE_MFS_TMPVAR}" = "true" ]; then |
|
207 |
/bin/mkdir -p /var/db /var/cache |
|
208 |
ln -sf ../../root/var/db/pkg /var/db/pkg |
|
209 |
ln -sf ../../root/var/cache/pkg /var/cache/pkg |
|
191 |
# If RAM disks are active, make symlinks for pkg database |
|
192 |
if [ -n "${USE_RAMDISK}" -o -n "${MOVE_PKG_DATA}" ]; then |
|
193 |
ramdisk_link_pkgdb |
|
194 |
fi |
|
195 |
|
|
196 |
# If activating RAM disks failed, then undo some of the above actions |
|
197 |
if [ -n "${USE_RAMDISK}" ] && ramdisk_failed; then |
|
198 |
ramdisk_fixup_zfs mount |
|
199 |
ramdisk_relocate_pkgdb disk |
|
200 |
else |
|
201 |
ramdisk_reset_status |
|
210 | 202 |
fi |
211 | 203 |
|
212 | 204 |
# Read product_name from $g, defaults to pfSense |
... | ... | |
245 | 237 |
# Use php -n here because we are not ready to load extensions yet |
246 | 238 |
varrunpath=$(/usr/local/bin/php -n /usr/local/sbin/read_global_var varrun_path "/var/run") |
247 | 239 |
|
248 |
if [ "${USE_MFS_TMPVAR}" != "true" ]; then
|
|
240 |
if ! ramdisk_is_active; then
|
|
249 | 241 |
/sbin/mdmfs -S -M -s 4m md $varrunpath |
250 | 242 |
fi |
251 | 243 |
|
Also available in: Unified diff
RAM Disk robustness improvements. Fixes NG 3173
state if the RAM disks cannot be created
which FreeBSD now prevents, but could result in errors.
sizing RAM disks
storage, RAM disks, or if set for RAM disks but they failed to work
the disk sizes
console. These messages can be commented out or removed in the future,
but are helpful for the time being.
(cherry picked from commit 82bf21fc37ef436f0d8439a84a97d61a7d5979b6)