Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Redirect disk writes

  • 11-05-2012 12:39pm
    #1
    Registered Users, Registered Users 2 Posts: 10,339 ✭✭✭✭


    I have a question for anyone familiar with linux filesystems

    Is there any way to nominate an existing directory and have any disk writes to that folder redirected to a different folder instead so that the original folder remains untouched?

    If it can be done, can it be done without requiring a restart? Can it be done like a switch, ie: redirection on / redirection off ?

    no specific reason for this or real world application, more if a curiosity question than anything.

    being theoretical the OS doesnt really matter but for arguments sake lets say Fedora 15 or Ubuntu 11 (desktop or server doesnt matter).


Comments

  • Registered Users, Registered Users 2 Posts: 14,048 ✭✭✭✭Johnboy1951


    Create a file of required size.
    Create a filesytem in that file

    When required, mount the file at the location of the directory.

    Once mounted all writes to the directory will go into the file.

    When required, unmount the file, and none of the writes are in the directory ..... they are in the filesystem in the file.


  • Registered Users, Registered Users 2 Posts: 2,755 ✭✭✭niallb


    Read up on "Union Mounts" before you jump into it as there are a few restrictions,
    but in general it's quite straightforward.


  • Registered Users, Registered Users 2 Posts: 78 ✭✭timbyr


    You can use a bind mount.
    This link has a decent quick tutorial.
    http://backdrift.org/how-to-use-bind-mounts-in-linux


  • Closed Accounts Posts: 7,563 ✭✭✭leeroybrown


    The best way to do what you want under Linux is to place that specific directory in a filesystem on an LVM volume. You can then create snapshot volumes based on this volume whenever you want. The original directory continues to be used normally and the snapshot can be mounted to access the files exactly as they were at that point in time.


  • Registered Users, Registered Users 2 Posts: 10,339 ✭✭✭✭LoLth


    tyvm guys. I always think its best to research before asking questions but my google skills let me down on this one. (I was quite confused when "redirect disk writes to alternate directory" didnt return anything useful. I began to wonder if it was possible at all)

    Thanks for the reference points to get started (and the advice)

    much appreciated.


  • Advertisement
Advertisement