Linux

From My Wiki
Jump to: navigation, search

Reset Kernel

Some hosts (eg OVH) customize the kernel of the linux os they provide. Heres how to fix it.

sudo apt-get install linux-image-server
mv /etc/grub.d/06_OVHkernel /etc/grub.d/25_OVHkernel
update-grub
shutdown -r now

Notes on /etc/grub.d

Grub = GNU GRand Unified Bootloader. Allows selection of multiple operating system on boot, or specific kernel configurations. Files in that dir listed alphabetically form the boot order. the mv command moves ovh's custom kernal to a lower level which means that another kernal will be used in its place.


Swap

originally retrieved from: https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-12-04

But essentially it goes like this:

Create the swap file itself:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024k

The swap file will be initially filled with zeros (0s). The file will be created at /swapfile. bs specifies the block size in bytes. A block is a unit measuring the number of bytes that are read, written, or converted at one time. count specifies how many blocks. Here creating a file made up of 1024k blocks, each having a size of 1024 creates a 1 Gb file.

Creating a linux swap area

sudo mkswap /swapfile

Activating the swap file

sudo swapon /swapfile

Automount this on reboot

sudo nano /etc/fstab
/swapfile       none    swap    sw      0       0 


Check summary of swap usage

swapon -s

Check memory usage to confirm swap is usable.

free -m

Where my disk space gone?

gt5

disk formatting

If the new volume has never been formatted, you need to format the volume using mkfs before you can mount it.

For instance, the following command creates an ext4 file system on the volume:

~# mkfs -t ext4 /dev/nbd1

which then can be mounted by say...

mkdir -p /mnt/data
mount /dev/vdb /mnt/data
ls -la /mnt/data/

persisting mount

/etc/fstab: 
/dev/vdb /mnt/data auto  defaults,nobootwait,errors=remount-ro 0 2

(not sure if working)

tmpfs / ram disk

how to make a temp fs?? ..

mkdir -p /var/tmpfs
sudo mount -t tmpfs -o size=512M tmpfs var/tmpfs


check with

df -h

disk speed test

read

sudo hdparm -Tt /dev/sda

write

dd if=/dev/zero of=/tmp/output bs=8k count=10k; rm -f /tmp/output