Create a 1 GB file to swap to (we have sufficient space on / on this machine. Use a different partition if necessary)
sudo dd if=/dev/zero of=/var/swapfile bs=1M count=1024
If you prefer 2GB swap, chose count=2048
, 4GB: count=4096
Change permissions of swap file:
sudo chmod 0600 /var/swapfile
Set up swap file and enable it:
sudo mkswap /var/swapfile
sudo swapon /var/swapfile
You should see your swap space now:
thomas@machine:~$ free -m
total used free shared buffers cached
Mem: 7700 7655 45 0 75 1237
-/+ buffers/cache: 6342 1357
Swap: 2047 0 2047
If you want to make the changes permanent add those lines to /etc/fstab
/var/swapfile none swap sw 0 0
Related cards:
Capistrano 3: assets:precompile only on one server
Disclaimer
This should not be necessary in any case and is only for special cases, for e.g. if the assets directory is linked to a shared storage (for e.g. glusterfs). Please mind that it isn't wise to move your assets directory to a shared s...
Run multiple Redis servers on Ubuntu
This is a way to run multiple redis server on one ubuntu server.
These steps you have to do only once:
- Adjust init script
Change some Variables.
From this:
DAEMON_ARGS=/etc/redis/redis.conf
NAM...
Why Apple Silicon MacBooks Can Only Use One External Display Through A Dock
It's quite confusing how many external displays are usable with a MacBook that uses an M1 or M2 Chip. Documentation on the Internet is sparse and not even the Geniuses at the Genius Bar are 100% sure. We found out some things and can explain the b...
Lenovo Laptop BIOS Update with Linux
You will need to look here and find your own device. Look for the "bootable CD" download, which will give you an ISO file.
Then you need a Perl script from the interne...
Resize an Areca Raid by swapping disks
If you want to expand your Areca Raid by swapping out the disks for larger ones you will need to do the following:
-
Swap out all disks one by one and wait until the syncronisation is finished in between.
-
Reboot your server and enter the Rai...
Linux performance analysis
Brendan Gregg is the Linux performance god. Use the information in this link to find out what ways there are for performacne analysis.
This link is shows the more sophisticated way and encourages to dig deeper for optimizing your system. If you'r...
Networking restart on FreeBSD
If you try to restart you may encouter the problem that your networking connection gets shutdown but not start again. Here is the right way to restart networking on FreeBSD:
service netif restart && service routing restart
create htpasswd entry and print to stdout
Create htpasswd entry and print to stdout:
$ sudo apt install apache2-utils # Optional
$ htpasswd -n $USERNAME
New password:
Re-type new password:
$USERNAME:<Password Hash>
stopping / restarting libvirt on Ubuntu 16.04 with systemd
Because systemd is the greatest thing ever it's not enough to stop the libvirt service. You need to disable the libvirt socket too.
sudo systemctl stop libvirt-bin
sudo systemctl stop libvirt-bin.socket
sudo systemctl start libvirt-bin
dumping and restoring PostgreSQL databases
This card is just about creating simple PostgreSQL dumps. This is no instruction for a backup strategy nor a guide for SQL dump performance optimization.
Read before starting
- I will assume that all commands will be executed as local `postgr...