Jonno's blog

how to resize/expand a LVM partition on a GPT partition table in CentOS 6

Some dummy somewhere removed the 'resize' command from `parted`. But this old version didn't work with LVM partition types anyway. You need parted 3.2

# yum install device-mapper-devel readline-devel libuuid-devel
# mkdir /opt/parted
# cd /opt/parted
# wget ""
# tar xJvf parted-3.2.tar.xz
# cd parted-3.2
# ./configure
# make
# ./parted/parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: AMCC 9650SE-8LP DISK (scsi)
Disk /dev/sda: 10000GB

Installing MySQL 5.6 from rpm

Oracle has broken various aspects of installation of MySQL 5.6 via RPM.
See, among others,

If you want to install with a non-default data directory (/db_data/mysql in this example), here are some steps you need to take:

1. set up your /etc/my.cnf with datadir setting, etc
2. install the RPM (yum install MySQL-server)
3. rm /usr/my.cnf (WTF???)
4. mv /var/lib/mysql/* /db_data/mysql/ (installer generally obeys datadir, but 'mysql_install_db' does not)
5. start mysql (service mysql start)
6. clear root password or set it to something else:
TEMPPW=$(foo=`cat /root/.mysql_secret`; echo ${foo##* });
mysql --connect-expired-password -p$TEMPPW -e "SET PASSWORD = '';"

continue as normal.

mysql grant subqueries

MySQL doesn't allow subqueries inside GRANT statements (only inside SELECT, INSERT, UPDATE, DELETE, SET, or DO). Here's a workaround using bash, when you want to grant based on a wildcard pattern in the schema name:

mysql -e "grant select on $(mysql -N -e "select distinct table_schema from information_schema.tables where table_schema like 'foo%';").* to user@host;"

Flowchart of InnoDB writes (logs, buffers)

I whipped this up originally to aid in explaining how Xtrabackup works, but I find useful for explaining replication as well. Feel free to complain at me if you find any inaccuracies or omissions :)

(edit: sorry I can't immediately figure out how to make the Drupal theme wider, and I'm too lazy to resize the image. Click on it for a full view.)

activate serial console on CentOS 6 (or RedHat EL 6)

How to activate the serial console in CentOS 6. Useful for logging into a virtual guest via 'virsh console'.


# ttyS0 - agetty

stop on runlevel [016]
start on runlevel [345]

instance ttyS0
pre-start exec /sbin/securetty ttyS0
exec /sbin/agetty /dev/ttyS0 115200 vt100-nav

then run
start ttyS0

Syndicate content