[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] Newbie question



Sergio Rua writes the following:
>
>I have just installed NBD looking the possibility of replacing a NFS
>server. However, my first test made me think that I may not understand
>how NBD works.
>
>I've created a filesystem on a file:
>
>dd if=/dev/zero of=NBD.raw bs=512k count=100
>mke2fs -j NBD.raw

Good so far....

>and I got the nbd-server running:
>
>nbd-server 1234 NBD.raw

Still good...

>The server is mounting this file/fs on /mnt
>
>moun -t ext3 -o loop NBD.raw /mnt

(ignoring the typo) This is valid, but...

>
>and so it has the client (different server)
>
>mount /dev/nbdtest /mnt -o ro

Oops, now you have the same filesystem mounted in two different places. What
happens when you try that with a local hard drive? Something like this:

# mount -t ext3 /dev/hda1 /usr
# mount -t ext3 /dev/hda1 /mnt
mount: /dev/hda1 already mounted or /mnt busy
mount: according to mtab, /dev/hda1 is mounted on /usr

It won't let you do that, because it's a bad idea. Adding "-o ro" to the
second mount doesn't help.

In your case, you didn't get a warning that you were doing something wrong
because mount and losetup aren't smart enough to notice that the file in
question is already being exported by nbd-server.

In the /dev/hda1 example above, the desired effect can be obtained with
mount --bind /usr /mnt (or even rmdir /mnt;ln -s usr /mnt), but that doesn't
apply to your case.

>Until here, everything very smooth. But now, I just did
>touch /mnt/TEST on the server but this file didn't appear on the client
>until I remount the block device.
>
>Is this how it is supposed to work? Why?

If you want the same filesystem to be mounted by multiple machines at the
same time, NBD is probably not the right answer. Try NFS, it will be a lot
closer.

-- 
Alan Curry
pacman@...49...




Reply to: