Maybe the title is confusing, but let me explain a little...
Our mysql servers (on xen virtual machine) sometimes generate huge tmp files on disk. So we need a big tmpdir to store them. And we decide to mount tmpdir to SSD for better performance. But as you know SSD is somehow expensive and mysql does not always generate that huge tmp files. So if we give every vm mysql a big SSD then it's a waste. So we want to only give small SSD (actually virtual disk backed on xen SSD) to each tmpdir ( e.g. 10G ).
But as said earlier sometimes mysql generate huge tmp files more than 10G. If that happens then mysql queries will be failed. So we want it dose like this:
combine an ssd and hdd into one drive (so it can be mounted to mysql tmpdir). when ssd is used up all space then use hdd.
Then I thought dmseupt or LVM maybe can do this. So I did a simple test:
1 SSD 0.5G | 1 HDD 10G | A logical volumn span two drive above | A ext4 file system on logical volumn above
And use dd tool to generate some file of size 0.3 G. Then I can see SSD usage grown 0.3G and HDD not changed. Everything is great until now! But when I delete that file, then create, then delete, ... do like so.
It turns out the hdd space usage is continually increasing!
So I guest ext4 dose not tend to overwrite the deleted file? Can we disable this feature or is there another file system prefer write low LBA first?
Thanks for reading!