# mount_nullfs not distinct paths



## lithius (Nov 26, 2009)

Hello everyone,

is there any way to attach (mount) nullfs layer to the same place as the old layer ? For example:


```
mount -t nullfs /test /test
```

The result of this command is that those paths are not distinct paths. So is there any way to do that ? Is it even possible ?

Thanks.


----------



## SirDice (Nov 26, 2009)

Why on earth would you want to do that?


----------



## lithius (Nov 26, 2009)

Well, because I want to hide the underlying layer and I want to access to this layer only through the nullfs (or another) layer above.

I certainly should mount nullfs to another place in filesystem, but the files will be accessible from more than one place and I do not want this.

Do you have any suggestions ?


----------



## lithius (Nov 26, 2009)

I have done some experiments with mount_nullfs and removed failsafe which stops me from mounting nullfs layer to the same place as old layer. Now I konw that it is not possible, at least by this easy "nullfs hack" way, beacuse of "Resource deadlock". 

Well then, I suppose there is not any easy way to do that ...


----------



## SirDice (Nov 26, 2009)

lithius said:
			
		

> Well, because I want to hide the underlying layer and I want to access to this layer only through the nullfs (or another) layer above.



Why? Please tell me what you want to do because I have no idea what you're trying to accomplish.


----------



## lithius (Nov 26, 2009)

Ok then.

I am going to write fs layer which should provide functionality similar to Redirfs in Linux. Redirfs is linux kernel module which is intended to be used by so called filter. It provide interface to register some inode, dentry and file operations, which when are called are first redirected to the filter (encrypt data etc...) and then particular operation of underlying filesystem is called.

So nullfs in FreeBSD seems to me as good thing to start with. But, in order to provide simple usability I thought that it would be nice to just mount this layer above the old filesystem, without need to attach it somewhere else. 

So I just asked if there is some simple way to do this (mounting new layer to the same place as the old layer).


----------



## SirDice (Nov 26, 2009)

lithius said:
			
		

> I am going to write fs layer which should provide functionality similar to Redirfs in Linux. Redirfs is linux kernel module which is intended to be used by so called filter. It provide interface to register some inode, dentry and file operations, which when are called are first redirected to the filter (encrypt data etc...) and then particular operation of underlying filesystem is called.


I might misunderstood you here but it sounds exactly like what GEOM is doing now.

See geom(8).


----------



## lithius (Nov 26, 2009)

Well, I must admin that I am pretty new in FreeBSD so I am not familiar with GEOM. I will look at it closely.

Anyway, thank you for this tip.


----------

