Growing the file system of a default Centos 7 install

6 Mar

If you’re deploying a Centos.7 VM image and need to resize it, there are two options:

  • Add an additional disk add incorporate it as a LVM physical volume
  • Extend the current physical volume and grow the PV and LV

I’m going for the second one in my test setup, for a default CentOS 7 install these are the steps:

  1. Power off the VM.
  2. Increase the size of the disk.
  3. Power on and run disk, removing the current LVM partition and recreating it to expand it to the new size (in my test setup, this is /dev/sda and the second partition, /dev/sda2).
  4. Reboot again, in order to make the kernel pickup on the new partitioning.
  5. Resize the physical volume: pvresize /dev/sda2
  6. Verify the new size with pvdisplay
  7. Grow the logical volume by adding all the available space:
    lvresize -l +100%FREE /dev/centos/root
  8. Finally, grow the actual root partition – no need to reboot:
    xfs_growfs /

Turning off buffering

1 Mar

Often you need to turn of buffering of stdout. I can never for the life of me remember the command for this, so here it is:

stdbuf -i0 -o0 -e0 command

Keeping track of sysadmin actions

16 Jan

I’ve been using Unix for quite a while. A few decades, actually.

For all this time, I’ve always kept notes on the commands done when installing and upgrading important services. For some reason, the very handy tool “script” has completely eluded my until now – it’s a little bit easier then logging from screen or tmux, invoked as simple as:

root@firewall1:/mnt# script install.log
Script started, file is install.log
root@vpn:/mnt# apt-get install openvpn
Reading package lists… Done
Building dependency tree
Reading state information… Done


root@vpn:/mnt# exit
exit
Script done, file is install.log

What goes in the file is the entire session, just as in a tmux log but a little easier to get it going. I’ll add it to my documentation toolbox for sure!

 

Backup strategies, part 1

10 Apr

Backing up is easy, right?

There’s nothing more important than to make sure that your valuable data is backed up in the right way so that, when disaster strikes, you’re covered and get back to where you left off as soon as possible.

While that may sound simple, it really isn’t. There’s a wealth of different backup solutions out there, but in order to succeed with any of them you must have done some planning first which usually boils down to the following steps: Continue reading