Date: Fri, 11 Jul 2008 00:39:41 +1000 From: Mark Gladman <mark@legios.org> To: freebsd-geom@freebsd.org Subject: Re: Can GEOM be used to intercept the I/o calls to an existing mounted device? Message-ID: <200807110039.42114.mark@legios.org> In-Reply-To: <482257ad0807100655u1a5c660awfad05564e40e9a95@mail.gmail.com> References: <482257ad0807100541s2d2c3d1eo6cd57c3a1bc338d1@mail.gmail.com> <200807102309.03191.mark@legios.org> <482257ad0807100655u1a5c660awfad05564e40e9a95@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Ah, I see what you mean... Not as far as I'm aware - although there's people here much more knowledgeable on the subject than me. You can write the geom metadata to the mounted disk(s) by settings the following sysctl kern.geom.debugflags=16 (This is potentially unsafe, but for what you're doing it should be fine) Out of curiosities sake though, I did the follwing. (note - I had to do this on a zvol on this workstation, so hopefully it's not invalid) mount /dev/zvol/zpool0/test /mnt sysctl kern.geom.debugflags=16 gmirror label -v -n -b round-robin gm0 /dev/zvol/zpool0/test kldload geom_mirror However, if I then do mount /dev/mirror/test0 /mnt2 Then do *anything* involving /mnt2, it causes FreeBSD to keel over - not totally unexpected. I'm not sure if this helps - hopefully others can chime in. On Thursday 10 July 2008 23:55:40 Tapan Chaudhari wrote: > Thanks Mark, but unmounting will anyways work. But the problem here will > be, a new device "/dev/mirror/gm0" and "/dev/mirror/gm0s1" will be created > after > > :- > > #gmirror label -v -n -b round-robin gm0 /dev/md0 > #gmirror load > #gmirror configure -a gm0 > > and "/dev/md0s1" gets deleted. > Now I will have to mount the new device "/dev/mirror/gm0s1" to get my > original contents. > Can't I do it on the fly while the device is already mounted? I just want > that all the calls going to the device "/dev/md0s1" first come to me and > then it goes to the original device. In short intercepting the i/o calls. > Is there some way I can achieve this? > > Thanks, > > On Thu, Jul 10, 2008 at 6:39 PM, Mark Gladman <mark@legios.org> wrote: > > On Thursday 10 July 2008 22:41:25 Tapan Chaudhari wrote: > > > Hi All, > > > I am a newbie to FreeBSD and GEOM. I wanted to intercept the i/o > > > > calls > > > > > going to a particular mounted device by writing some driver. > > > I came across geom and thought it might work. I tried to create a new > > > device, mount it and then tried using gmirror to mirror the device :- > > > > > > #dd if=/dev/zero of=file1 bs=1M count=10 > > > #dd if=/dev/zero of=file2 bs=1M count=10 > > > #mdconfig -f file1 > > > #mdconfig -f file2 > > > #fdisk -B /dev/mirror/md0 > > > #newfs /dev/mirror/md0s1 > > > #mkdir /mnt/mirror0 > > > #mount /dev/mirror/md0s1 /mnt/mirror0/ > > > > > > #gmirror label -v -n -b round-robin gm0 /dev/md0 > > > gmirror: Can't store metadata on /dev/md0: Operation not permitted. > > > > > > It gave me this error "gmirror: Can't store metadata on /dev/md0: > > > > Operation > > > > > not permitted." > > > > > > Am I doing something wrong? Or GEOM does not permit me intercept the > > > i/o calls? If not geom, is there any other mechanism by which I can > > > achieve > > > > it? > > > > > Thanks, > > > --Tapan. > > > _______________________________________________ > > > freebsd-geom@freebsd.org mailing list > > > http://lists.freebsd.org/mailman/listinfo/freebsd-geom > > > To unsubscribe, send any mail to "freebsd-geom-unsubscribe@freebsd.org" > > > > Hey, > > > > You're attempting to set up gmirror on a mounted device. > > Unmount /dev/mirror/md0s1 then retry the gmirror command and it should > > work. > > > > Cheers! > > Mark > > _______________________________________________ > freebsd-geom@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-geom > To unsubscribe, send any mail to "freebsd-geom-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807110039.42114.mark>