Do I need a journalling filesystem for both host and guest operating systems when using virtualization? [closed]
Using VirtualBox, I've got a few Linux guests for different distros running on an Ubuntu host.
What filesystem layout will give the best performance?
Is it worth it to set up a different partition on the host just for the guests, with no journalling?
Or, conversely, should I disable journalling in the guests?
Solution 1:
The journalizing of filesystems typically only protect the metadata-portion of the filesystem. In the case of virtualization, the whole filesystem of the guest is considered data to the host OS. So in the case where you'd need journalizing, it doesn't help when either the host-filesystem itself or just the client FS gets corrupted.
Also, the overhead of journalizing is neglectable compared to the IO losses you have simple by virtualizing, which is magnitudes larger (if you get 50% of your original IO capacity to the guest, you are lucky, with plain VirtualBox, you probably get only ~30%). You shouldn't worry about the journal here. Thus my advice is: always use a journalizing filesystem.
Another point to mention is the time to restore in case of a crash. One of the most important tasks the journal fulfills is to ease recovery in case on an unclean shutdown. If you use a journalizing filesystem the time used be the mandatory fsck
is going to be magnitudes smaller than on an unjournalized filesystem. This fact alone might be a deal-breaker if you need halfway decent restore times.
When you actually need IO, at least use a Type-1 Hypervisior (like Xen or KVM), which makes it easier to get to the 50% (or even a bit more) of remaining IO capacity, or use application-level virtualization like OpenVZ which only uses a minimal amount of resources itself.
Solution 2:
Reiterating what's already been said here by others:
What filesystem layout will give the best performance? Ext4 currently performs near the top of the pack. No file system performs best in all cases. Some perform better for edge cases.
Is it worth it to set up a different partition on the host just for the guests, with no journaling? Journaling overhead is typically a negligible amount of overhead compared to other things that could be tuned, like the disk sub-system.
Or, conversely, should I disable journaling in the guests? No.
Do I need a journaling filesystem for both host and guest operating systems when using virtualization? Yes, because you want to test real world cases.
Increase the speed of disk I/O. When that become cost prohibitive then look at non-standard file systems.
- Are you using raid on the host?
- Do you have at least 4 drives in the raid set? (7200rpm sata 1gb = $60 - Total $240)
- Do you have a multi-core CPU chip?
- Do you have more than enough memory for all running virtuals plus 1gb for the host? I find less memory allocated to the virtual leaves more for a single host disk cache rather than two large caches. One in the virtual and the other on the host. This is faster in my setup. Reduce the memory allocated to each virtual. Make there is enough so you never swap.
- Do you have a Nvidia Fermi ($60) or equiv performance level video card?
- Do you have an SSD drive?
- Directory depth should remain low.
- Number of files in any directory should remain reasonably low.
- Don't use swap, buy more memory.
- Turn off services not needed both in host and virtuals.
- Configure the virtual machines with only the hardware needed for each virtual.
- Depending on the use cases, use a netbook or alternate pc for web surfing, music and video watching. Web browsers with flash are high CPU users.