Well, since I had to brood about this (again I might add), I’m gonna write it down this time …
Setting up the InnoDB raw device isn’t that hard, just make sure the device has proper permissions (either add mysql to the disk group or create a udev rule).
1 |
KERNEL="sdb2", OWNER="mysql", GROUP="mysql" |
Now after that (and a reboot/udevcontrol reload_rules later), you should be able to initialize the InnoDB device. Yes, the InnoDB device needs initializing.
When you create a new data file, you must put the keyword newraw immediately after the data file size in innodb_data_file_path.
The next time you start the server, InnoDB notices the newraw keyword and initializes the new partition.
After that is done, you should be able to start the MySQL service for the first time. It is gonna fail (at least according to the init-script), but ultimatly if you take a closer look at /var/log/mysqld.log it’s gonna be successful.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
14:11:07 InnoDB: Setting file /dev/sdb2 size to 50200 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000 ... 50200 14:21:26 InnoDB: Log file ib_logfile0 did not exist: new to be created InnoDB: Setting log file /var/lib/mysql/db/ib_logfile0 size to 512 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 200 300 400 500 14:21:34 InnoDB: Log file ib_logfile1 did not exist: new to be created InnoDB: Setting log file ib_logfile1 size to 512 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 200 300 400 500 InnoDB: Doublewrite buffer not found: creating new InnoDB: Doublewrite buffer created InnoDB: Creating foreign key constraint system tables InnoDB: Foreign key constraint system tables created 14:21:42 InnoDB: Started; log sequence number 0 0 |
After that, remove the “newraw” from your /etc/my.cnf. Otherwise, MySQL is gonna reinitialize the volume all over again, as the handbook states.
However, do not create or change any InnoDB tables yet. Otherwise, when you next restart the server, InnoDB reinitializes the partition and your changes are lost.
After InnoDB has initialized the new partition, stop the server, change newraw in the data file specification to raw.