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!

 

Building a CentOS test VM

12 Dec

This is just some notes regarding how to create a CentOS 7 performance test VM.

Work in progress!

  • Start with a CentOS 7 minimal ISO
  • Bring up networking: nmtui
  • Configure proxy settings in .bash_profile, if needed
  • Enable the EPEL (Extra Packages for Enterprise Linux): yum install epel-release
  • yum install iperf iperf3 git texinfo
  • yum groupinstall ‘Development Tools’
  • git clone https://github.com/HewlettPackard/netperf.git
  • Edit configure.ac ,uncomment AC_CHECK_SA_LEN macro
  • Edit configure, change am__api_version from 1.14 to 1.13 to match aclocal version
  • Diff for the two above steps here: netperf-centos7.patch
  • ./configure
  • make install