Bug #75646 '/dev/raw/raw1' not a regular file
Submitted: 27 Jan 2015 9:29 Modified: 28 Feb 2015 19:31
Reporter: ZhongMing Guo Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:5.6.19 OS:Linux (Ubuntu LTS1410)
Assigned to: CPU Architecture:Any
Tags: innodb, raw device, regression

[27 Jan 2015 9:29] ZhongMing Guo
Description:
We got this problem while upgrading our mysql servser from 5.5 to 5.6, 
And also in build a new mysql database.

InnoDB refuses to use the existing raw device.  
 Configuring newraw does nothing either.

System: Ubuntu 1410
Mysql: Ubuntu package 5.6.19-1
InnoDB using a raw partition.

version:
guo@guo-desktop:~$ sudo uname -a
Linux guo-desktop 3.16.0-29-generic #39-Ubuntu SMP Mon Dec 15 22:27:29 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
guo@guo-desktop:~$ sudo mysqld --version
mysqld  Ver 5.6.19-1~exp1ubuntu2 for debian-linux-gnu on x86_64 ((Ubuntu))
guo@guo-desktop:~$ 

We use stand raw device in our linux computer. We use mysql as database system .
in the old version such as mysql 5.5, we have done a lots times, succes use raw device in mysql.   
but we could not use it in mysql 5.6.19.

we use many technique  things in mysql.
For example, We used 2 and more harddisk to build soft raid1 or soft raid1+0,  
 we also use ssd(or ssd raid) as a flashcache on harddisk  raid,
then we bind /dev/raw/raw1 on flashcache mapper.

use in mysql 5.6.19, In fact, we found that we only binded a disk to raw, such as 
raw /dev/raw/raw1 /dev/sdf1 
We still could not start mysql .

this is our test: 

1) because raw module now did not loaded by default in ubuntu system, we added  "raw" line in file /etc/modules, 
 after reboot system, we could see the raw module had been started.

guo@guo-desktop:~$ sudo cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
raw
guo@guo-desktop:~$
guo@guo-desktop:~$ sudo lsmod|grep raw
serio_raw              13434  0 
snd_rawmidi            30876  1 snd_seq_midi
snd_seq_device         14497  3 snd_seq,snd_rawmidi,snd_seq_midi
snd                    87611  21 snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_seq,snd_rawmidi,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel,snd_seq_device
raw                    13091  1 
guo@guo-desktop:~$ 

2) We bind the raw device,  we can see the raw device success binded.
We alse change the own of the raw device to mysql

guo@guo-desktop:~$ sudo raw /dev/raw/raw1 /dev/vghd/p2
/dev/raw/raw1:  bound to major 252, minor 2
We alse tested normal harddisk,   example:   sudo raw /dev/raw/raw1 /dev/sdf1, It is the same result.

guo@guo-desktop:~$ 
guo@guo-desktop:~$ sudo ls -l /dev/raw/raw1
crw-rw---- 1 root disk 162, 1  1月 27 16:26 /dev/raw/raw1
guo@guo-desktop:~$ 
guo@guo-desktop:~$ sudo chown mysql /dev/raw/raw1
guo@guo-desktop:~$ sudo ls -l /dev/raw/raw1
crw-rw---- 1 mysql disk 162, 1  1月 27 16:26 /dev/raw/raw1
guo@guo-desktop:~$ 
guo@guo-desktop:~$ sudo rm /var/lib/mysql/ibdata1
guo@guo-desktop:~$ sudo rm /var/lib/mysql/ib_logfile0
guo@guo-desktop:~$ sudo rm /var/lib/mysql/ib_logfile1

config /etc/mysql/my.cnf  line: 
innodb_data_home_dir= 
innodb_data_file_path=/dev/raw/raw1:800Gnewraw

guo@guo-desktop:~$ sudo service mysql stop
guo@guo-desktop:~$ sudo service mysql start
error-log:
2015-01-27 12:29:39 3769 [Note] InnoDB: Completed initialization of buffer pool
2015-01-27 12:29:39 3769 [ERROR] InnoDB: '/dev/raw/raw1' not a regular file.
2015-01-27 12:29:39 3769 [ERROR] InnoDB: The system tablespace must be writable!
2015-01-27 12:29:39 3769 [ERROR] Plugin 'InnoDB' init function returned error.
2015-01-27 12:29:39 3769 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2015-01-27 12:29:39 3769 [ERROR] Unknown/unsupported storage engine: InnoDB
2015-01-27 12:29:39 3769 [ERROR] Aborting

3) In usually, We do not change own of raw device as 2), we bind a node to raw device, then it is more security, 
because ubuntu apparmor restrict access other catalog 。

guo@guo-desktop:~$ sudo ls -lL /dev/raw/raw1
crw-rw---- 1 root disk 162, 1  1月 27 12:09 /dev/raw/raw1
guo@guo-desktop:~$ sudo mknod /var/lib/mysql/myraw1 c 162 1
guo@guo-desktop:~$ sudo chown mysql:mysql /var/lib/mysql/myraw1
guo@guo-desktop:~$ sudo ls -l /var/lib/mysql/myraw1
crw-r--r-- 1 mysql mysql 162, 1  1月 27 12:14 /var/lib/mysql/myraw1

config /etc/mysql/my.cnf  line:
innodb_data_home_dir= 
 innodb_data_file_path=/var/lib/mysql/myraw1:800Gnewraw

guo@guo-desktop:~$ sudo rm /var/lib/mysql/ibdata1
guo@guo-desktop:~$ sudo rm /var/lib/mysql/ib_logfile0
guo@guo-desktop:~$ sudo rm /var/lib/mysql/ib_logfile1
guo@guo-desktop:~$ sudo service mysql stop
guo@guo-desktop:~$ sudo service mysql start
error-log:
2015-01-27 12:21:03 3584 [Note] InnoDB: Completed initialization of buffer pool
2015-01-27 12:21:03 3584 [ERROR] InnoDB: '/var/lib/mysql/myraw1' not a regular file.
2015-01-27 12:21:03 3584 [ERROR] InnoDB: The system tablespace must be writable!
2015-01-27 12:21:03 3584 [ERROR] Plugin 'InnoDB' init function returned error.
2015-01-27 12:21:03 3584 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2015-01-27 12:21:03 3584 [ERROR] Unknown/unsupported storage engine: InnoDB
2015-01-27 12:21:03 3584 [ERROR] Aborting

How to repeat:
How to repeat:
Take a Ubuntu  1410 server or desktop version , install the mysql-package5.6:
guo@guo-desktop:~$ sudo apt-get install mysql-server-5.6

Try to configure a raw partition. 
Look into the error log.

Suggested fix:
No clue :( Only known raw device can work in 5.5 or old version, but  can not  be used in 5.6 :|
[27 Jan 2015 13:57] MySQL Verification Team
Hello ZhongMing Guo,

Thank you for the report.
Imho this is most likely duplicate of Bug #75616

Thanks,
Umesh
[4 Feb 2015 1:06] Matthew Lord
Hi!

This does appear to be a duplicate of BUG#75616 , as Umesh noted, because you created the device as a character special file.

To be sure, can try this instead:
mknod /var/lib/mysql/myraw1 b 162 1

That should work as a temporary fix. 

If not, please let us know.

Thank you for the bug report!

Best Regards,

Matt
[28 Feb 2015 19:31] ZhongMing Guo
thanks, I have solved the problem.  

Starting with the Linux 2.6 kernel, raw devices are being phased out in favor 
   of O_DIRECT access to block devices.

I changed the file  /etc/mysql/my.cnf like this:
innodb_data_file_path            = raw1:1812479Mraw
innodb_flush_method             = O_DIRECT

I did not use old raw device,  I just use mknod  like this:
 "/dev/vghd/raw1" is a lvm2 logic volum , we use it as  a raw device.

$ sudo ls -lL /dev/vghd/raw1
brw-rw---- 1 root disk 252, 2  3月  1 03:03 /dev/vghd/raw1

$ sudo mknod /var/lib/mysql/raw1 b 252 2
$ sudo chown mysql:mysql /var/lib/mysql/raw1
$ sudo chmod 660 /var/lib/mysql/raw1

$ sudo ls -l /var/lib/mysql/raw1
brw-rw---- 1 mysql mysql   252, 2  3月  1 03:06 raw1

so it can works. it is ok now.
 thank you, you are so nice and so quick to process the bug report,  
Many people will thank you for your work.