Single HDD shared between multiple machines (VMs)
This is really a file system question, but I am posting here in VM land because this is something that will probably only ever come into play in VMs (for now at least).
My question is this, I create 3 hard drive images on my machine, image A and B both contain full linux operating systems, and image C has whatever on it. I start two simultaneous virtual machines, One boots from image A, the other boots from image B, however, BOTH VMs attempt to mount C with Read and Write access. What will happen to C? Will the filesystem be damaged immediately? Will it be damaged when one machine unmounts the image? Will it work fine? I assume that the filesystem will be damaged somehow, if I am using most types of filesystems, such as ext2, ext3, or ext4. However, I know that filesystems such as NFS can handle multiple machines accessing the fs with rw access, however, to my knowledge you cant format a partition with NFS. Are any filesystems capable of this? which ones? |
Why not loop mount image C from the host and have the host offer C using NFS?
|
It is not a good idea to do that. Better to use access via nfs or ftp or some other indirect method instead. You may be able to mount a drive to two OS's but it will fail and you will loose data. Also do not use a similar shared folder for two machines.
|
Quote:
NFS is a workaround, not a solution. Its totally possible to design an FS that can handle two machines mounting it simultaneously, I know that because NFS does it. I am interested in other filesystems that can do that without NFS. |
I think you are confused about what nfs is and what ext2/3/4 format is and how a vm works and how an OS interacts with a mounted filesystem. What you suggest has not been created except on a very special type of filesystem used in a very special way. You do not want to use a mount command to mount a drive or partition to two VM's at the same time.
|
Quote:
I am fully aware that these file systems were not DESIGNED with that functionality in mind, but that doesn't mean that it won't work. I used NFS as an example because the NFS server IS able to handle multiple mounts without damage, this is nothing more than proof that it is possible for a system to exist that can preserve data when it is being accessed by two simultaneous devices which are unaware of each other. There are many other file system types, NTFS, FAT, btrfs, ReiserFS, BeFS, XFS, YAFFS, UFS, XFS, HFS+, NILFS, GFS2, OCFS, JFS, etc.. As a matter of fact, I read over some of the Linux kernel source (3.0.1, kernel.org is still down), and apparently GFS2 has a locking mechanism that will allow one machine to lock it while writing to prevent data corruption, so it looks like it actually was designed to do what I want. OCFS may also be another option. |
I think you are trying to fix something that isn't broken. The basic mount command was never designed to have more than one OS controlling it. You are missing the way a host host controls a drive. No matter how you think of it a VM in many ways acts like a real computer. You can't easily mount a virtual file system as a mounted drive to two OS's.
You have an issue that has been addressed for decades in many cics type of transactional projects. That is way I said to use some other means to share the data that has transactional locks in place. Read up on how IBM and other database's address this issue. You handle it at the software level not the hardware level. |
Quote:
And I was never trying to say that it should work because they are VM's, I understand that a VM acts as a real computer, and what I want to do should work on real hardware too, but since that type of hardware is very specialized, so its easier to express the problem with VMs. I know that it needs to be handled on the software level, thats what I have been talking about this whole time, filesystems are software. Anyway, its pointless to argue as I have already found the solution I was looking for: GFS2 Global File System, its a file system that was designed to do exactly what I said, it uses DLM as a lock manager and is designed to be accessed by a cluster of computers. The linux kernel has built in drivers to mount and use that file system, so all you need on top of that is the userland tools to actually create the FS. |
Quote:
Quote:
|
Quote:
|
Quote:
But it still applies: you WILL have to use network |
All times are GMT -5. The time now is 08:31 AM. |