Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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?

share|improve this answer
    
Ha! That did it! Why is it not advised? dev.mysql.com/doc/refman/5.5/en/innodb-raw-devices.html –  Clayton Dukes Dec 4 '11 at 20:31
    
it is mostly because modern filesystems are fast enough, that raw device performance gain is marginal and you lose some of the comfort of using files. as far as i was able to find any advice on this topic, in most cases it seems best practice to use file per table in InnoDB. –  Fox Dec 4 '11 at 20:55
    
(fromdual.ch/mysql-performance-tuning-key 359n states this as last resort, 359l recommends fpt, goo.gl/EF1Uv doesen't recommend it either) –  Fox Dec 4 '11 at 21:02
    
Good info, thanks guys! –  Clayton Dukes Dec 4 '11 at 21:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.