Comment 1 for bug 747032

Yves Trudeau (y-trudeau) wrote :

Hi,
  this is due to the way mysql_data_home is set in init_cachedev. I resolved the issue of a customer by adding a "cd $datadir" in the init.d script. Looking at the strace of 5.5.20, I got:

statfs(".", {f_type=0x58465342, f_bsize=4096, f_blocks=67010513, f_bfree=60639395, f_bavail=60639395, f_files=268172992, f_ffree=268172980, f_fsid={2054, 0}, f_namelen=255, f_frsize=4096}) =
 0
open("/etc/mtab", O_RDONLY) = 3
futex(0x318878c020, FUTEX_WAKE_PRIVATE, 2147483647) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=464, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd5c33b5000
read(3, "/dev/sda2 / ext4 rw 0 0\nproc /pr"..., 4096) = 464
statfs("/", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=12901535, f_bfree=11879844, f_bavail=11224484, f_files=3276800, f_ffree=3176908, f_fsid={1141234244, 1206473618}, f_namelen=255
, f_frsize=4096}) = 0
statfs("/proc", {f_type="PROC_SUPER_MAGIC", f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0

so the target directory in $bindir which in the case of this customer, is on a different partition. Looking at the same extract from 5.1.60:

statfs("/var/lib/mysql/", {f_type=0x58465342, f_bsize=4096, f_blocks=63446558, f_bfree=63175977, f_bavail=63175977, f_files=253910208, f_ffree=253910131, f_fsid={64768, 0}, f_namelen=255, f_
frsize=4096}) = 0
open("/etc/mtab", O_RDONLY) = 3
futex(0x365c18c020, FUTEX_WAKE_PRIVATE, 2147483647) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=464, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f07718dd000
read(3, "/dev/sda2 / ext4 rw 0 0\nproc /pr"..., 4096) = 464
statfs("/", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=12901535, f_bfree=12156233, f_bavail=11500873, f_files=3276800, f_ffree=3216720, f_fsid={439050054, -1249199248}, f_namelen=255
, f_frsize=4096}) = 0
statfs("/proc", {f_type="PROC_SUPER_MAGIC", f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
statfs("/sys", {f_type="SYSFS_MAGIC", f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0

Which now correctly consider /var/lib/mysql.

Yves