Cannot mount a nfs share after doing a snapshot

Greg Byshenk freebsd at byshenk.net
Mon Jan 7 03:06:54 PST 2008


On Sun, Jan 06, 2008 at 05:38:30PM +0100, Jose Garcia Juanino wrote:
> El domingo 06 de enero a las 15:41:21 CET, Greg Byshenk escribi?:
> > On Sat, Jan 05, 2008 at 11:28:31PM +0100, Jose Garcia Juanino wrote:
> >  
> > > I have a 7.0-PRERELEASE i386 system with a nfs server, with an unique export
> > > line in /etc/exports file:
> > > 
> > > / -maproot=root -network 192.168.1.0 -mask 255.255.255.0
> > > 
> > > After a reboot, I have no problem mounting this nfs share from a nfs client.
> > > But after issuing the following command on the server:
> > > 
> > > # mount -u -o snapshot /.snap/now /

> > Is the problem that you are trying to mount your snapshot on top of the /
> > directory?  I use snapshots, but have never tried to do this, and can 
> > imagine that there might be a problem, since the snapshot is itself a
> > snapshot of a filesystem (different than the actual root filesystem).
> > 
> > That would explain the error:

> > > Jan  5 22:47:03 gauss mountd[542]: can't delete exports for /: Cross-device link
 
> No, I am not trying to mount the snapshot. I am just taking (making) the
> snapshot, as man mount says.

Sorry, I wasn't following this (as I said, I don't work with snapshots in
this way).

I've looked at the 'mount' man page, and it seems that it should work the
way you are trying to do it. That said, because taking a snapshot grabs
the entirety of a filesystem, I can well imagine that trying to take a 
snapshot of the root filesystem while at the same time exporting that
filesystem via NFS will cause a problem.

> > What happens if you create a directory and mount your snapshot there:
> > 
> > 	mkdir /snapshotmount
> > 	mount -u -o snapshot /.snap/now /snapshotmount
> >
> > If this works, then you may need a separate exports line for /snapshotmount.
 
> # file /.snap/now
> /.snap/now: Unix Fast File system [v2] (little-endian) last mounted on
> /, last written at Sun Jan  6 16:24:19 2008, clean flag 1, readonly flag
> 1, number of blocks 130721, number of data blocks 126520, number of
> cylinder groups 4, block size 16384, fragment size 2048, average file
> size 16384, average number of files in dir 64, pending blocks to free 0,
> pending inodes to free 0, system-wide uuid 0, minimum percentage of free
> blocks 8, TIME optimization

Ok, so it looks like your /.snap/now snapshot actually exists, and is being
made, so it looks like the command

	# mount -u -o snapshot /.snap/now /

is actually working. (So ignore the rest of what I said last time...)


I've just played with this a bit myself (I'm no expert, but I use snapshots
currently with 6-STABLE and want to know about any future problems), and I
can reproduce the problem (7.0-PRERELEASE as of 2 Jan 2008). I see the same
sort of errors as you report, and they cannot be cleared even by removing
the snapshot file and restarting nfsd/mountd. The only solution appears to
be to remove the snapshot and restart the machine. I can see how this might
be a bit inconvenient.

That said, there appears to be a problem with using the 

	# mount -u -o snapshot <snapshot> <filesystem>

form of the command.

The problem does _not_ occur (at least in my test) if you use the the

	# mksnap_ffs <filesystem> <snapshot>

command. Can you try taking a snapshot using mksnap_ffs?

If mksnap_ffs works, while 'mount -u -o' fails, then it looks like a bug...

-greg

 

-- 
greg byshenk  -  gbyshenk at byshenk.net  -  Leiden, NL


More information about the freebsd-stable mailing list