FreeBSD 11.1 on 8GB USB (how to save disk space?)

I actually install FreeBSD 11.1 RELEASE on a USB that run fine. But the USB have a few space about 8 GB (do not just say that I need bought a bigger USB) some people don't have money to buy new things.

I'm looking for some tips to reduce the space used by the system, logs or something unnecessary things.

I mark the delete of /tmp folder.

Actually a only install base + kernel source. (I'm developing some chars device modules for the kernel)

There is ways to remove logs generation or its ok redirect all the logs to /dev/null?

Regards!
 
Last edited by a moderator:
The system itself doesn't generate too much noise, so if it's a typical setup you have, the logs should be the least of your concerns. It all depends on what applications are running.

Have /tmp mounted on tmpfs(5).

In the /boot/kernel, remove all *symbols files. Build a custom minimalist kernel, removing all modules you will never need. The same goes with the world.
 
Log files can define in
/etc/newsyslog.conf.

You can define a small size and then use a cronjob to delete frequently all *.bz2 in /var/log.

i.e. some content of my newsyslog.conf:
Code:
# size    When the size of the log file reaches size in kilobytes, the log
#         file will be trimmed as described above.  If this field contains
#         an asterisk (`*'), the log file will not be trimmed based on size.

# when    The when field may consist of an interval, a specific time, or
#         both. If the when field contains an asterisk (`*'), log rotation
#         will solely depend on the contents of the size field.
#         interval in hours: `@'-sign and a time in restricted ISO 8601 format

# flags   J - using bzip2

# logfilename          [owner:group]    mode count    size       when  flags [/pid_file] [sig_num]
#/var/log/all.log                        600    7      *         @T00   J
/var/log/amd.log                         644    7     100        *      J
/var/log/auth.log                        600    7     100        *      JC
/var/log/console.log                     600    5      100       *      J
/var/log/cron.log                        600    3      *         @T00   JC
/var/log/daily.log                       640    7      *         @T00   JN
/var/log/debug.log                       600    7     100        *      JC
...
 
Log files can define in
/etc/newsyslog.conf.

You can define a small size and then use a cronjob to delete frequently all *.bz2 in /var/log.

i.e. some content of my newsyslog.conf:
Code:
# size    When the size of the log file reaches size in kilobytes, the log
#         file will be trimmed as described above.  If this field contains
#         an asterisk (`*'), the log file will not be trimmed based on size.

# when    The when field may consist of an interval, a specific time, or
#         both. If the when field contains an asterisk (`*'), log rotation
#         will solely depend on the contents of the size field.
#         interval in hours: `@'-sign and a time in restricted ISO 8601 format

# flags   J - using bzip2

# logfilename          [owner:group]    mode count    size       when  flags [/pid_file] [sig_num]
#/var/log/all.log                        600    7      *         @T00   J
/var/log/amd.log                         644    7     100        *      J
/var/log/auth.log                        600    7     100        *      JC
/var/log/console.log                     600    5      100       *      J
/var/log/cron.log                        600    3      *         @T00   JC
/var/log/daily.log                       640    7      *         @T00   JN
/var/log/debug.log                       600    7     100        *      JC
...

You don't need a separate cron job. Change the numbers under "count" to a lower value (make them all 3 or something like that). The newsyslog utility will then automatically delete the oldest files and only keep the 3 most recent.
 
Back
Top