[Unionfs] Problem with unionfs
Stephan Schöffel
schoeffel at fh-bingen.de
Fri Feb 15 07:02:13 EST 2008
Jesse I Pollard schrieb:
> Stephan Schöffel wrote:
>> Jesse I Pollard schrieb:
>>> Stephan Schöffel wrote:
>>>> hi there,
>>>>
>>>> i'm still new to unionfs. i followed the tutorial on this website
>>>> http://flaviostechnotalk.com/wordpress/index.php/2005/06/28/filesystem-snapshots-with-unionfs/
>>>> which was linked at the unionfs website.
>>>>
>>>> the example did work but it does not fit my problem properly. i
>>>> tries different things but could not get it to work the way i want.
>>>>
>>>> here is what i want:
>>>>
>>>> i want (via script and using unionfs) to bring different
>>>> directories to their original state if the machine is rebooted. eg
>>>> i want to delete files users write to /tmp
>>>> i used the following approach:
>>>>
>>>> modprobe unionfs
>>>> mkdir /tmp_union
>>>> mount -t unionfs -o dirs=/tmp=rw unionfs /tmp_union
>>>> mkdir /tmp_snap
>>>>
>>>> unionctl /tmp_union --add --mode rw /tmp_snap
>>>> unionctl --mode ro /tmp
>>>>
>>>>
>>>>
>>>>
>>>> unfortunately, users can still write to /tmp and the changes are
>>>> not logged in /tmp_snap. is there a way to bring /tmp back to its
>>>> original state by using unionfs?
>>> I'm going out on limb, but what you want depends on other things:
>>>
>>> 1. do you use a disk based filesystem for /tmp?
>>> 2. do you need large amount of space for /tmp?
>>>
>>> One reason for these questions is that you COULD use a ramfs for
>>> /tmp. On every
>>> reboot, ram is cleared.
>>>
>>> Aternative to ramfs or unionfs:
>>>
>>> If a resident disk based filesystem is required, then just mkfs that
>>> filesystem
>>> before mounting it. An /etc/rc script with something like:
>>>
>>> mkfs /dev/hda6
>>> mount /dev/hda6 /tmp
>>>
>>> Even if you do want to use a unionfs, you will have to mount that
>>> union on /tmp
>>> to prevent users from accessing the underlying filesystem:
>>>
>>> 1. mount the scratch filesystem somewhere users cant directly get to
>>> it, such as
>>> /var/scratch/tmp_snap
>>> and make /var/scratch only accessable to root.
>>>
>>> 2. The readonly FS underlying scratch must be mounted somewhere
>>> users can't get to
>>> either:
>>> /var/scratch/tmp
>>>
>>> 3. Mount the unionfs thus:
>>>
>>> mount -t unionfs -o
>>> dirs=/var/scratch/tmp_snap=rw:/var/scratch/tmp=ro none /tmp
>>>
>>> 4. and on every boot you still have to erase the tmp_snap.
>>>
>>> Personally, I think you need either the ramfs or the non-unionfs
>>> version.
>>
>>
>> i tried as you recommended, unffortunately without success. i was
>> able to do the mount but then i would not be able to write files to
>> tmp as a user anymore.
>>
>>
> Does the directory (the tmp_snap) have rwxrwxrwt permissions?
no, it didn't. it does nahve no and it works. thank you very much.
More information about the unionfs
mailing list