Creating a raw InnoDB disk in Ubuntu 10.04 with LVM

apparmorinnodb

I'm trying to create a 2TB raw partition for MySQL/InnoDB to use on one of my LVM's.

I created the raw disk:

Disk /dev/mapper/g0-sql: 2190.4 GB, 2190433320960 bytes
255 heads, 63 sectors/track, 266305 cylinders, total 4278190080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Then added the newraw command to my.cnf:

innodb_data_home_dir=
innodb_data_file_path=/dev/dm-1:2000Gnewraw;

When I restart mysql, I get a permission denied:

111204 14:43:43 [Note] Plugin 'FEDERATED' is disabled.
111204 14:43:43  InnoDB: Initializing buffer pool, size = 68.0G
111204 14:43:48  InnoDB: Completed initialization of buffer pool
111204 14:43:48  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name /dev/dm-1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.

I assumed this was Apparmor, so I added the following to /etc/apparmor.d/usr.sbin.mysqld:

/dev/dm-1/ r,
/dev/dm-1/** rwk,

I've also chowned /dev/dm-1:

# ll | grep dm-1
brw-rw----  1 mysql mysql   252,   1 2011-12-04 11:48 dm-1

But the error continues.
How do I get this sucker to work?

edit:
/dev/mapper/g0-sql is symlinked to /dev/dm-1, both are chowned to mysql

Best Answer

I'm guessing a little, but can your problem be in your apparmor profile? you're referring to /dev/dm1/ as if it were a directory, which is a file (block device)

I will suggest trying /dev/dm-1 rwk in your profile ...

btw. are you aware that usage of raw innodb tablespace is generally not advised?