Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
Hi all, I'm interested in installing RHEL server on a solid state drive. I would like to make this OS read-only as to prolong the longevity of the drive (these ...
  1. #1
    Just Joined!
    Join Date
    Jun 2010
    Posts
    14

    Question How to make a read-only OS?

    Hi all,

    I'm interested in installing RHEL server on a solid state drive.
    I would like to make this OS read-only as to prolong the longevity of the drive (these SSDs have a limited number of write-cycles before they start to fail).
    Any recommendations on how I can do this?

    Jon

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    By solid state drive do you mean one with a hard drive form factor and controller electronics? Or do you mean something like flash memory (SD card or USB drive)?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Jun 2010
    Posts
    14
    By solid state drive do you mean one with a hard drive form factor and controller electronics? Or do you mean something like flash memory (SD card or USB drive)?
    I mean one that uses a hard drive form factor with a controller.
    For example, the Intel X25-M, 160GB drive with a SATA interface.

    Basically, you can consider the drive as a regular hard disk from a functional point of view, except I need to minimize the number of writes done to it.

  4. #4
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,047
    The system files are pretty static. Most writes happen in /tmp, /var/ and /home.
    Can't tell an OS by it's GUI

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    You can mount or remount most any file system as read-only, though as Freston mentioned some such as /var and /tmp as well as the swap partition/file must be writeable. Those you could put on rotating media if you like - they don't have to be on the same physical device as the rest of the OS. Then, when you need to update/upgrade/patch the OS or change configurations you can temporarily remount the needed volume as read-write.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #6
    Just Joined!
    Join Date
    Jun 2010
    Posts
    14
    Thanks for your help so far guys. That's basically what I want to do but i'm having some trouble with the implementation.

    I've tried changing fstab to make the directories / and /home as read only, but this cause my system to hang at boot and I had to reinstall Red Hat.

    Any other ways of doing this?

  7. #7
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by jon_p View Post
    Thanks for your help so far guys. That's basically what I want to do but i'm having some trouble with the implementation.

    I've tried changing fstab to make the directories / and /home as read only, but this cause my system to hang at boot and I had to reinstall Red Hat.

    Any other ways of doing this?
    1. You cannot make / read-only. It can be in a ram disc if necessary, but it has to be writable. Ditto /tmp and /var.
    2. /home is for user directories and should probably be on rotating media since it is likely to need to be read-write anyway.

    Look at how live CD/DVD/USB system images are configured for more information on how you might do this. In any case, it is likely you will need a custom system installation and not just some simple configuration tweaks to do what you want. Also, you don't need to do a reinstall to fix things like the fstab issue. You can boot from a live CD/DVD/USB drive and manually mount and fix the file in question, then simply reboot to get back to operation.

    One (or two) final bit(s) of advice. Start the system normally, configured as you want it, but without the read-only bits enabled. Then, look at what files are opened for write by the OS and normal applications, servers, daemons. That will tell you which bits need to be on read-write media and you can take measures to ensure that they are. Finally, plan this out and learn as much as you can about the system operation and understand the nuances of what you want to accomplish first, then plan the changes to be done in stages. You will save time, have a more stable system, and be happier with the results.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  8. #8
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,047
    Quote Originally Posted by Rubberman
    likely you will need a custom system installation and not just some simple configuration tweaks to do what you want
    You give excellent advice Rubberman! But as to the above, I have the thought that jon_p doesn't so much want a read-only filesystem as that he wants to preserve his disk (due to limited write capability).

    I think he's not so much at risk because the system files are pretty static.

    But do you know, now we're on the subject , if for example an update or an edit of a file causes an overwrite, or is a new file created ( a newwrite so to speak) and the old one 'forgotten' (but the bits are still in place).

    For example, I edit /etc/profile a thousand times. Does that wear out that portion of the disk, or do I have a thousand profiles somewhere on the disk, but only one is actively represented in the filesystem?
    Can't tell an OS by it's GUI

  9. #9
    Just Joined!
    Join Date
    Jun 2010
    Posts
    14
    Quote Originally Posted by Freston View Post
    For example, I edit /etc/profile a thousand times. Does that wear out that portion of the disk, or do I have a thousand profiles somewhere on the disk, but only one is actively represented in the filesystem?
    Depends entirely on the drive and it's controller. With the more modern SSDs that use wear-leveling algorithms, the short answer is no; new data is placed in physically different locations but to the OS this remains under a layer of abstraction.


    Then, look at what files are opened for write by the OS and normal applications, servers, daemons.
    How would I do this? Sorry, I know my hardware but Linux is new to me.

  10. #10
    Just Joined!
    Join Date
    Jun 2010
    Posts
    14
    Alternatively, turning my existing system image into an .iso and booting from that would be great. This way, after I boot everything would be running off RAM and (ideally) nothing would get written to the disk.

    Again, I'm not sure how to do any of this. Could someone point me to the right place?

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...