Set the number of reserved filesystem blocks of a disk

The default value of “Reserved block count” takes 5% of usable disk. On a large fs like 813G, it represents about 40G.

These blocks are reserved to the super user to recover from situations where user processes fill up filesystems.
It is absolutely safe to reduce this space to one hundred or so MB.

  • check disk space of our filesystem:
$ df -h /dev/sda4
/dev/sda4             813G  418G  354G  55% /home

Before the tuning, we have 354G free.

  • check the current number of reserved blocks:
$ tune2fs -l /dev/sda4
...
Reserved block count:     10816865
...

Change this number to 20000.
The blocksize is 4096, 20000 blocks represent about 80MB.

$ tune2fs -r20000 /dev/sda4
...
Reserved block count:     20000
...
  • check disk space of our filesystem:
$ df -h /dev/sda4
/dev/sda4             813G  418G  395G  52% /home

We now have a gain of 40GB of free space!

This entry was written by CharlyBr, posted on June 30, 2009 at 9:55 am, filed under Optimization, Uncategorized and tagged , . Leave a comment or view the discussion at the permalink.

Use multiple memcached daemons on FreeBSD

As you may know, when using memcached on 32-bit servers, processes can only address 4GB of virtual memory making the memcached daemon handle only 2 or 3 Gb of memory.

If you want to address more memory, you need to launch multiple memcached daemons.

I wrote an rc script , mmemcached, for FreeBSD to manage this.

To use it, you need to add this in /etc/rc.conf:

mmemcached_enable="YES"
mmemcached_servers="1 2"
mmemcached_user="nobody"
mmemcached_args="-c 8192 -t 2 -m 2048 -d"

Copy the mmemcached script in /usr/local/etc/rc.d for example and launch it with the start argument. With the above configuration it will launch two memcached daemons listening on ports 11211 and 11212 (mmemcached_servers parameter) with 2Gb of memory.

Configuration

Details of the rc.conf configuration:

  • mmemcached_enabled: let this script “startable”,
  • mmemcached_servers: List of the daemons you want to start. Each number is used to generate the port number of the daemon. For example, 2 will launch a daemon listening on port 11212,
  • mmemcached_user: user that will start the daemon,
  • mmemcached_args: flags to pass to the daemon.

Download

Download the script on github.

This entry was written by CharlyBr, posted on October 2, 2008 at 12:23 pm, filed under Distro, Uncategorized and tagged , . Leave a comment or view the discussion at the permalink.

How to know the maximum RAM supported by your server?

The dmidecode command gives you all informations available about your memory.

With the special parameter “-t 16″, you can see the maximum (physical) memory that your server can have:

$ dmidecode -t 16
# dmidecode 2.8
SMBIOS 2.4 present.

Handle 0x1000, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Multi-bit ECC
Maximum Capacity: 32 GB
Error Information Handle: Not Provided
Number Of Devices: 8

Here we can see that your server can handle up to 32Gb

Check empty memory slots

To know which slots are used or not use the “-t 17″ flag.

dmidecode -t 17 | grep Size
        Size: 2048 MB
        Size: 2048 MB
        Size: No Module Installed
        Size: No Module Installed
        Size: No Module Installed
        Size: No Module Installed
        Size: No Module Installed
        Size: No Module Installed

Links

This entry was written by CharlyBr, posted on August 4, 2008 at 8:42 am, filed under Uncategorized and tagged , . Leave a comment or view the discussion at the permalink.