LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-23-2009, 11:23 AM   #1
Four
Member
 
Registered: Aug 2005
Posts: 298

Rep: Reputation: 30
Mount a file system but only write to memory


I want to mount the root file system in a way writes are possible, but do not touch the actual hard drive, so that when the system is rebooted its back to the way it was initially.

Is this possible? It should since Live CD's do this, the CDrom is booted I can download and write all I want (with limit to my memory).

If it helps the machine is Ubuntu.

Thank you
 
Old 11-23-2009, 11:42 AM   #2
maslik
Member
 
Registered: Nov 2009
Location: Czech republic
Distribution: Ubuntu
Posts: 43

Rep: Reputation: 17
In my opinion the only way to go will be to copy whole filesystem to a ramdisk on startup and then mount it. Probably there's a better solution, but this is the only possibility I can imagine.
 
Old 11-23-2009, 11:44 AM   #3
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
You should be able to do the same thing a live CD does. The ones I understand (maybe all of them) use aufs as the key component that lets everything else write to the file system without overwriting any of the original content.

There are several details you need to think through before setting it up. I only know the concepts, not the specifics, so I can only tell you what to ask yourself before setting this up, not how to use the answers.

When does the rule of not writing to the hard disk start and how strict is it?
Is the starting point an existing system you can't modify? (Which I think would mean you need to boot from something else). Or can you add everything you will need for this project to a disk based system before starting the rule of no writes to disk?

What about the swap partition on the disk? Can you use that or is it also off limits?

Using a tmpfs backed by the swap partition as the front side of aufs would give you more flexibility than being really limited to ram. But if you have enough ram, you could manage with no swap and nothing other than ram for the ram disk or tmpfs (I'm not sure which is better if you have no swap).

Quote:
Originally Posted by maslik View Post
In my opinion the only way to go will be to copy whole filesystem to a ramdisk on startup and then mount it. Probably there's a better solution, but this is the only possibility I can imagine.
The advantage of aufs over that plan is that the aufs automatically copies each file from disk to ram only when you modify that file. It starts faster because it copies less. It fits in far less ram because it copies less.

Last edited by johnsfine; 11-23-2009 at 11:46 AM.
 
Old 11-23-2009, 11:48 AM   #4
maslik
Member
 
Registered: Nov 2009
Location: Czech republic
Distribution: Ubuntu
Posts: 43

Rep: Reputation: 17
Hm, that sounds interesting. I haven't heard about aufs before. Thank you for your information.
 
Old 11-23-2009, 01:32 PM   #5
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Well, you could always boot up a live CD and mount the HDD filesystem read-only ... would that be enough ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot write mounted vista file system trefin56 Linux - Newbie 5 11-22-2009 08:36 AM
[SOLVED] File I/O and System Memory Ronayn Programming 4 12-23-2008 06:37 AM
Bash - is it possible to write to memory rather than a file basildon Linux - Newbie 7 09-24-2008 12:07 PM
disable write in file system jobless_joe Linux - Newbie 4 01-13-2005 07:23 AM
how to write a fat16 file system!? Linos Linux - Software 4 09-09-2003 05:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration