Monday, January 31, 2011

Moving your mysql database to another hard disk

Recently, my server's only hard disk was almost full. I bought a new hard disk with bigger size and I decided to just add it as a second hard disk. Since I need to move it to the 2nd hard disk, I need to find a proper way to move the db with minimum downtime. So I googled around and found a solution.

First, I needed to format the 2nd hard disk and I chose xfs as the filesystem. I created 2 partitions using Linux's fdisk for this task. First partition is 10 GB and 2nd one is around 900 GB. That's approximately added up to 1 TB. Then I mounted the 2nd partition in current partition eg /media/hd2 as follows:

mount -t xfs /dev/sdb5 /media/hd2

where /dev/sdb5 is the partition and /media/hd2 is the mounting dir.

Stop mysql db before doing anything:

service mysql stop

Afterthat, I copied the entire db to newly mounted hard disk:

cp -rv /var/lib/mysql /media/hd2

It will take a while if you have huge databases.

Then, change the ownership of the dir to user and group of mysql:

chown -R mysql:mysql /media/hd2/mysql

You need to change the mysql config file in /etc/my.cnf to point to the dir:

[mysqld]
user = mysql
datadir = /media/hd2/mysql
port = 3306
socket = /var/lib/mysql/mysql.sock
pid-file = /var/run/mysqld/mysqld.pid

Now you can restart mysql db:

service mysql start

If there are no errors on startup, you can test by login to your mysql db and do sql query.

You can leave other settings as it is. If this doesn't work and if you use innodb, you may want to change these lines:

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql/
#innodb_log_arch_dir = /var/lib/mysql/

Make sure you test your dbs before deleting the old ones. Have fun!

Tuesday, January 18, 2011

The easiest way to 'burn' iso to USB disk.

The easiest way to 'burn' iso to USB disk is by using dd command. Let's say you don't want to burn your newly downloaded iso to CD/DVD but want to use USB disk instead, you can run this command :

dd if=/path/to/file.iso of=/dev/sdb

This assumes your USB disk is /dev/sdb. You can use mount command to check what device your USB disk is using. Now you can install your new distro using USB disk.

Note: You can burn iso this way if the iso is of type hybrid. Read here for more information.

Have fun!

Tuesday, January 4, 2011

/usr/include/linux/netfilter_ipv4.h:53: error: ‘INT_MIN’ was not declared in this scope

This error happened when I was compiling dansguardian 2.10.1.1 with Linux netfilter support.

In file included from ConnectionHandler.cpp:48:
/usr/include/linux/netfilter_ipv4.h:53: error: ‘INT_MIN’ was not declared in this scope
/usr/include/linux/netfilter_ipv4.h:64: error: ‘INT_MAX’ was not declared in this scope
/usr/include/linux/netfilter_ipv4.h:65: error: ‘INT_MAX’ was not declared in this scope
make[2]: *** [dansguardian-ConnectionHandler.o] Error 1

To solve it, you have to edit netfilter_ipv4.h and type #include <limits.h> just below or after other #include lines.

Have fun!.

How to change the plymouth default theme

Plymouth is a graphical boot system that runs very early in the boot process. It provides graphical animation while the boot process happens in the background. Starting from Mandriva 2010 Beta, it replaced splashy to manage boot splash. Many latest distributions now are using plymouth. Since it displays graphical boot login, users usually do not bother to tinker with it.

What is the default theme?
To know the current default theme, run this command without any options:

plymouth-set-default-theme

Changing theme
To change plymouth theme, we have to know what themes are installed. To list them, run (as root):

plymouth-set-default-theme --list

You'll get something like this:

details
fade-in
Mandriva-Free
spinfinity
text

So to change to a particular theme as the default, for example fade-in, run :

plymouth-set-default-theme fade-in --rebuild-initrd

--rebuilt-initrd option is a must or the change won't take effect. You can explore other options by running plymouth-set-default-theme -h

Have fun!

Second monitor no display after latest update - KDE-neon

 After latest update as of Oct 3, 2023, my second monitor was undetected with latest kernel (6.2.0-33-generic). If I boot with previous kern...