Linux - How do I make a single folder RW and the rest of the filesystem RO?

08
2014-07
  • Hello World

    I have successfully configured my Debian Linux's file system to be read-only. I made several changes, however the file relevant to this question is /etc/fstab:

    proc            /proc           proc    defaults          0       0
    /dev/mmcblk0p1  /boot           vfat    defaults          0       2
    /dev/mmcblk0p2  /               ext4    defaults,ro,noatime,errors=remount-ro  0       1
    tmpfs           /tmp            tmpfs   nodev,nosuid,size=30M,mode=1777    0    0
    tmpfs           /var/log        tmpfs   nodev,nosuid,size=30M,mode=1777    0    0
    

    This is working great, but I want my /home directory to be "rw" (Of course, without losing any data), how do I do that? Everything is on a single hard drive in a single partition.

  • Answers
  • mtak

    It is impossible to have a read-write folder on a read-only filesystem. If you want to make your filesystems read only, you should create a different filesystem for /home to have that mounted read-write.

    1. Create a partition using fdisk
    2. Run mkfs.ext4 /path/to/partition
    3. Move /home to /home.old (mv /home /home.old)
    4. mkdir /home
    5. Edit /etc/fstab to include your newly created filesystem
    6. mount /home
    7. Copy all files to the new filesystem (cp /home.old/* /home/)
    8. Remove all files from the old filesystem (rm -rf /home.old)

  • Related Question

    filesystems - Access to File being restricted after Ubuntu crashed
  • Tim

    My Ubuntu 8.10 crashed due to the overheating problem of the CPU when I am opening some directory and intend to do some file transfer under Nautilus. After reboot, under gnome, all the files cannot be removed, their properties cannot be viewed and they can only be opened, although all are still fine under terminal. I was wondering why is that and how can I fix it?

    Thanks and regards


    UPdate

    $ cat /etc/mtab  
    /dev/sda7 / ext3 rw,relatime,errors=remount-ro 0 0  
    tmpfs /lib/init/rw tmpfs rw,nosuid,mode=0755 0 0  
    /proc /proc proc rw,noexec,nosuid,nodev 0 0  
    sysfs /sys sysfs rw,noexec,nosuid,nodev 0 0  
    varrun /var/run tmpfs rw,nosuid,mode=0755 0 0  
    varlock /var/lock tmpfs rw,noexec,nosuid,nodev,mode=1777 0 0  
    udev /dev tmpfs rw,mode=0755 0 0  
    tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0  
    devpts /dev/pts devpts rw,noexec,nosuid,gid=5,mode=620 0 0  
    fusectl /sys/fs/fuse/connections fusectl rw 0 0  
    lrm /lib/modules/2.6.27-15-generic/volatile tmpfs rw,mode=755 0 0  
    /dev/sda8 /home ext3 rw,relatime 0 0  
    /dev/sda2 /windows-c vfat rw,utf8,umask=007,gid=46 0 0  
    /dev/sda5 /windows-d fuseblk rw,allow_other,blksize=4096 0 0  
    securityfs /sys/kernel/security securityfs rw 0 0  
    binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,noexec,nosuid,nodev 0 0  
    gvfs-fuse-daemon /home/tim/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev,user=tim 0 0  
    

  • Related Answers
  • James T

    Try this.

    Open up the terminal.

    Type:

    sudo nautilus
    

    Now try to do whatever your trying to do in nautilus.

    Note that this will open up nautilus as the root user. The desktop and home folders will link to the root users profile so you'll have to navigate over to your own profile under File System and then home.

    you can also type chmod 777 filename in the terminal in order to set full read write and execute permissions for all users.

    EDIT:

    Please do an ls -al on the files you are talking about and paste them in so we can see the permissions and ownership of the files. If you are listed as the owner and group of those files and the permissions are set to full access... you might want to try running fsck -fy /dev/hda1 (or sda1) from single user mode or from a live cd

  • hlovdal

    I would guess that problems displaying files in Nautilus are tied to your user from your error description. Does the same problem occur if you log in as another user? Have you tried to rename $HOME/.gnome and $HOME/.gnome2 to something else?