Skip to content

Instantly share code, notes, and snippets.

@v6ak
Created September 18, 2014 08:54
Show Gist options
  • Save v6ak/65eb3df2c4e75e90d68f to your computer and use it in GitHub Desktop.
Save v6ak/65eb3df2c4e75e90d68f to your computer and use it in GitHub Desktop.
My optimizations for /var/log and /tmp/large
/dev/mapper/largetmp1 /tmp/large ext4 noauto,nosuid,noatime,delalloc,nobarrier,data=writeback,commit=36000 0 0
# There is a non-critial partition where /var/log is stored. When there aren't much data to be written, it simply waits up to one hour.
# This is aimed to reduce SSD write amplification. I hope it works correctly. I haven't verified it.
UUID=someeee-long-long-long-uuuuuuiiiddd /non-critical ext4 nosuid,noatime,commit=3600 0 2
#!/bin/bash
DEV=/dev/mapper/largetmp1
(
sudo mkfs.ext4 "$DEV" -E lazy_itable_init -m 0 -O sparse_super &&
sudo tune2fs -o journal_data_writeback "$DEV" &&
sudo tune2fs -O ^has_journal "$DEV" &&
sudo mkdir -p /tmp/large &&
sudo mount /tmp/large &&
sudo chmod 1777 /tmp/large
) || exit 2
% # I use symlink. It may be an suboptimal approach, I had some issues with AppArmor.
% # Since the /var/log is the only thing moved to /non/critical, I could have created a partition for /var/log.
% ll /var/log
lrwxrwxrwx 1 root root 22 Apr 4 22:21 /var/log -> /non-critical//var/log/
@daitangio
Copy link

Very nice trick, I am planning to use it in my RaspberryPI2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment