Find the answer to your Linux question:
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 27
Like Tree2Likes
You could just mount the device again to some directory with rw options. I mean: Do not unmount, or remount the readonly mountpoint. Just mount the device additionally to another ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,392

    You could just mount the device again to some directory with rw options.
    I mean: Do not unmount, or remount the readonly mountpoint.
    Just mount the device additionally to another directory XY with rw, make your changes, then unmount this new directory XY.

    This can potentially introduce loops, but for a short controlled action it should be ok-ish.
    lamle likes this.
    You must always face the curtain with a bow.

  2. #12
    Just Joined!
    Join Date
    Oct 2012
    Location
    Vaasa
    Posts
    11
    Quote Originally Posted by Irithori View Post
    You could just mount the device again to some directory with rw options.
    I mean: Do not unmount, or remount the readonly mountpoint.
    Just mount the device additionally to another directory XY with rw, make your changes, then unmount this new directory XY.

    This can potentially introduce loops, but for a short controlled action it should be ok-ish.
    Hi,
    Thanks a lot, this is a brilliant solution.
    Just to make sure I understand you, in what case you think it might create loops?

  3. #13
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,392
    Say, /dev/sda1 is /
    Then consider this:
    Code:
    mkdir /mnt/foo
    mount /dev/sda1 /mnt/foo
    lamle likes this.
    You must always face the curtain with a bow.

  4. #14
    Just Joined!
    Join Date
    Oct 2012
    Location
    Vaasa
    Posts
    11
    great many thanks.

  5. #15
    Just Joined!
    Join Date
    Oct 2012
    Location
    Vaasa
    Posts
    11
    Hi Irithori,
    I found out that one can have multiple mount points for the same partition but they will have the SAME access right, if I change access right in one mount point then the other mount point will get the same info.
    (because I think what is actually changed is the partition itself not the mount point)

    So the solution is unfortunately not applicable

  6. #16
    Linux Newbie
    Join Date
    Aug 2006
    Posts
    124
    Hi. As said above, I would vote for "impossible". The aim of mounting "RO" is to not allow ANY modification to file system, and changing permission is one modification. In consequence, I think what you ask is impossible.

  7. #17
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,392
    tbh, I knew you can have multiple mountpoints for one device,
    and I quickly tested it on a VM.
    It worked, but I did not change the mount options from one to another.
    Sorry about that
    You must always face the curtain with a bow.

  8. #18
    Just Joined!
    Join Date
    Sep 2012
    Posts
    5
    I may be reading this differently than intended, I would mount the partition, in Mate sudo into caja, sudo into Nautilus for Gnome, and mount the drive and set the partition to either root, not the best way, or to a specific user that will keep the partition up for the thread you are using. If you are using a gui there should be a disk manager under accessories. Find in a search so that it will be in a root operation. But remember, everything can blow up when using root. One wrong key stroke can mean serious problems. To paraphrase from carpentery, measure twice, click once. If it were me, I would set for a specific user. Then go into properties and set the partition's properties to that user. That way you are out of the root, even though you set it up in root. That way you can protect the thread but cannot mess anything up.

    I hope I understood you correctly. Good luck.

  9. #19
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,392
    @lamle, can you please describe in details, where the remount fails?
    You wrote, there is a thread using mmap.
    But which linux, which architecture, which kernel, which daemons, which filesystem are you using?

    I looked a little into it on a 64bit debian squeeze (6.0.6), kernel 2.6.32-5-amd64 and ext4.
    And while the testmethod is a bit crude, I had no problem remounting the device multiple times, while various read access was happening.
    Btw, if s/o knows an easy to use bash tool using mmap, preferable daemoniseable: Please do tell
    I just used grep.

    And as you can judge from the ls output, the remount worked everytime.
    Code:
    # Preparation
    mkdir -p /root/lf/testmountpoint
    cd /root/lf
    dd if=/dev/zero of=testdisk.dd bs=1G count=1
    mkfs.ext4 -F testdisk.dd
    losetup /dev/loop0 testdisk.dd
    mount /dev/loop0 testmountpoint
    dd if=/dev/urandom of=testmountpoint/foo bs=1M count=200
    umount testmountpoint/
    mount -o ro /dev/loop0 testmountpoint
    
    # generate various read load
    (while true; do dd if=testmountpoint/foo of=/dev/null iflag=direct &>/dev/null ;done)&
    SUB_PID_DISKDIRECT=$!
    (while true; do dd if=testmountpoint/foo of=/dev/null &>/dev/null ;done)&
    SUB_PID_DISKBUFFER=$!
    (while true; do grep --mmap whatever testmountpoint/foo &> /dev/null ;done)&
    SUB_PID_GREP_MMAP=$!
    
    # remount writetest
    for a in {1..10}; do 
      mount -o remount,rw testmountpoint/
      echo $a > testmountpoint/$a
      mount -o remount,ro testmountpoint/
      z=$RANDOM
      let "z %= 10"
      sleep $z
    done
    
    
    # Works just fine
    ls -lart testmountpoint
    total 204864
    drwxr-xr-x 3 root root      4096 Oct 11 23:57 ..
    drwx------ 2 root root     16384 Oct 11 23:59 lost+found
    -rw-r--r-- 1 root root 209715200 Oct 11 23:59 foo
    -rw-r--r-- 1 root root         2 Oct 11 23:59 1
    -rw-r--r-- 1 root root         2 Oct 11 23:59 2
    -rw-r--r-- 1 root root         2 Oct 11 23:59 3
    -rw-r--r-- 1 root root         2 Oct 11 23:59 4
    -rw-r--r-- 1 root root         2 Oct 11 23:59 5
    -rw-r--r-- 1 root root         2 Oct 11 23:59 6
    -rw-r--r-- 1 root root         2 Oct 11 23:59 7
    -rw-r--r-- 1 root root         2 Oct 12 00:00 8
    -rw-r--r-- 1 root root         2 Oct 12 00:00 9
    -rw-r--r-- 1 root root         3 Oct 12 00:00 10
    drwxr-xr-x 3 root root      4096 Oct 12 00:00 .
    
    
    
    #Cleanup
    kill $SUB_PID_DISKDIRECT
    kill $SUB_PID_DISKBUFFER
    kill $SUB_PID_GREP_MMAP
    sync
    umount testmountpoint
    losetup -d /dev/loop0
    cd
    rm -rf /root/lf
    You must always face the curtain with a bow.

  10. #20
    Just Joined!
    Join Date
    Oct 2012
    Location
    Delhi, India
    Posts
    19
    Quote Originally Posted by CaptainDangeax View Post
    Hi. As said above, I would vote for "impossible". The aim of mounting "RO" is to not allow ANY modification to file system, and changing permission is one modification. In consequence, I think what you ask is impossible.
    I totally agree.

Page 2 of 3 FirstFirst 1 2 3 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
  •