Announcement

Collapse
No announcement yet.

can't change ro to rw using command line

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    can't change ro to rw using command line

    I recently had to re-install my whole system due to a faulty hard disk. I was using 22.10 (upgraded from 22.04) and btrfs, so I had a recent snapshot on my external hard disk. First I installed 22.10 afresh with a USB drive, which worked fine. Then I renamed the new @ and @home so I could copy my snapshots to /mnt, and later re-name them to @ and @home. The send command worked well, and both snapshots are on /mnt. The trouble came when I tried to change the properties of the snapshot to read-write. I used this command: btrfs property set -ts /mnt/@_230205-200939_ro ro false and got back this error message:ERROR: cannot flip ro->rw with received_uuid set, use force if you really want that. I must add that to create these snapshots I used the btrfs subvolume manager scripts for Dolphin, by Oshunluvr. How can I change these two snapshots back to rw?

    #2
    As root one normally uses
    btrfs su snapshot -r /mnt/@ /mnt/snapshots/snapshot_root
    to create a read only snapshot of @ with a different name.

    To restore @ using snapshot_root the reverse is used. First, rename @ to get it out of the way.
    mv /mnt/@ /mnt/@_old
    then
    btrfs su snapshot /mnt/snapshots/snapshot_root /mnt/@

    Notice that the read only parameter, "-r", is not used. That coverts the ro snapshot_root to a rw @

    Why use the "-r" parameter? Because one can use the "btrfs send / receive" command only with ro snapshots.
    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.

    Comment


      #3
      Thanks for answering. However, I am a little confused with the exact contents of the command. I have already gotten both @ and @home out of the way (@old and @homeold, from your manual on the subject). In place, I have the two snapshots stored on the external disk, which I sent to the new disk drive, and both are in the /mnt folder. Using the exact name of the @ snapshot from above, would the command be : btrfs su snapshot /mnt/@_230205-200939_ro /mnt/@? I'm not sure where to put 'root', or what the result will be, so I want to make sure I'm doing the right thing, as this is the only thing hanging me up now. By the way, I tried to use Oshunluvr's btrfs service menu for Dolphin to change the setting, but when I checked the folder was still ro.

      Comment


        #4
        I tried the command the way I understood it, and it seemed to work OK, but when I checked the setting with the 'get' command, it still said ro. By the way, since the subvolume that I snapshot would end up in the same place as the original (/mnt) that would technically I would have two subvolumes with the same name in /mnt. This is what I got after the snapshot, using vdir to show the contents of /mnt. The snapshots subvolume is empty.

        drwxr-xr-x 1 root root 200 Kup 14 10:18 @_230205-200939_ro
        drwxr-xr-x 1 root root 30 Kup 14 12:24 @home_230205-201010_ro
        drwxr-xr-x 1 root root 30 Kup 13 22:43 @homeold
        drwxr-xr-x 1 root root 184 Kup 13 23:12 @old
        drwxr-xr-x 1 root root 0 Kup 13 23:13 snapshots

        I guess I'll have to leave the computer on until I get this figured out, as this is the only thing keeping me from advancing.


        Comment


          #5
          Originally posted by oldgeek View Post
          Thanks for answering. However, I am a little confused with the exact contents of the command. I have already gotten both @ and @home out of the way (@old and @homeold, from your manual on the subject). In place, I have the two snapshots stored on the external disk, which I sent to the new disk drive, and both are in the /mnt folder. Using the exact name of the @ snapshot from above, would the command be : btrfs su snapshot /mnt/@_230205-200939_ro /mnt/@? I'm not sure where to put 'root', or what the result will be, so I want to make sure I'm doing the right thing, as this is the only thing hanging me up now. By the way, I tried to use Oshunluvr's btrfs service menu for Dolphin to change the setting, but when I checked the folder was still ro.
          @ is "root" of you installation. /mnt is the rootfs subvolume when you mount /dev/sdxn to it.

          If you delete @old your system will freeze and you won't be able to reboot. You'll have to boot a USB ISO and load the btrfs command.

          "btrfs su snapshot /mnt/@_230205-200939_ro /mnt/@" will work but your nomenclature is very confusing. Appending "_ro" to a subvolume makes the name hard to read. At first I didn't see the underline and though you were using "ro" as a command, which it isn't. By not using the "-r" parameter with the snapshot command you will create a rw snapshot.

          My own approach is was/is to create a /mnt/snapshots subfolder and store snapshots in it to avoid cluttering up /mnt. That way only @ and @home reside under /mnt. All snapshots stored under /mnt/snapshots on my system are ro snapshots because they are being sent to my remote storage and the btrfs send/receive command only works with ro snapshots.

          I rarely use a rw snapshot, and when I do it is only for experimentation. As ro snapshots I know their contents won't change, so if I need to retrieve a file I changed or deleted on my system I know it will be in an ro snapshot. I keep about 30+ snapshots on my 1TB SSD M.2 980 EVO, and it uses only about 250GB because of compression.

          "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
          – John F. Kennedy, February 26, 1962.

          Comment


            #6
            As GreyGeek says, a snapshot of a ro subvolume is rw. While in the directory that has @old and @homeold,
            Code:
            sudo btrfs su sn @_230205-200939_ro​ @
            sudo btrfs su sn @home_230205-200939_ro​ @home
            Regards, John Little

            Comment


              #7
              Well, I seem to have done the snapshots correctly, as the directly of /mnt showed a new @ and @home. Unfortunately, i exited the terminal without unmounting either sda1 or sdb1, and when I tried to reboot, it wouldn't load. Sigh. Today I am re-installing the whole thing but am deciding just to send the backup @home and use the new @ and redo what I need to do to get back some settings. At least this way I won't crash the OS again. Thanks for the help, I'll let you know if it worked this time.

              Comment


                #8
                Just so everyone is aware, there has been a fairly recent change to the "set" command when changing ro to rw. The command now requires the "force" flag ( -f ). The reasoning was that ro snapshots are often used for incremental backups and therefore needed an extra level of scrutiny before switching them to rw and potentially messing up a backup cycle, thus the "use force if you really want that." message.

                IMO it's actually safer and easier to just re-snapshot to rw as has been suggested.
                Last edited by oshunluvr; Feb 15, 2023, 03:00 PM.

                Please Read Me

                Comment


                  #9
                  I only make my snapshots ro if I plan on transmitting (send|receive) the snapshot. I see no advantage to ro for a daily snapshot. On the other hand, since I would do another snapshot to roll back, it wouldn't really hurt me either. Similar to GreyGeek, I keep my snapshots in a subfolder named "/snapshots" under where I mount my root BTRFS file system, which is "/subvol".

                  When I need to roll back because I broke something, I do:

                  cd /subvol
                  sudo mv @ @bad
                  btrfs su sn snapshots/@lastsnap @
                  reboot

                  Takes like 8 seconds.

                  Please Read Me

                  Comment


                    #10
                    I finally got my system up and running by taking a snapshot of my ro @home and making that the new @home. I thank all those who have responded to this thread and I have learned something new about btrfs in the process.

                    Comment


                      #11
                      Congrats!
                      Personally, I would never consider a distro that didn't allow me to set BTRFS as the root filesystem as part of the install process, and I especially like the way Ubuntu/Kubuntu/Neon implement BTRFS. Being lazy, I merged @home into @ and I only have to snapshot @.

                      BTRFS allows me the liberty of trying anything I want and no matter what I do or how bad I mess up, my pre-experiment system is less than a minute away. I also do it before any updates, just in case. Two days ago Plasma 5.27 in 151 packages came down the pike, and this evening 221 more packages. I am unconcerned about a package breaking my system.

                      Aside: I've been playing with Plasma 5.27 and it is one awesome update!
                      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                      – John F. Kennedy, February 26, 1962.

                      Comment


                        #12
                        I hope Plasma 5.27 comes down soon from the Kubuntu 22.10 backports ppa. I just saw a video from Nick on Linux Experiment (Youtube) and he loves it. As for ext 4, I only use it on my 32-bit netbook with Mxlinux, but that is only an emergency backup computer as it's terribly slow and has less memory than an advanced Alzheimer patient.

                        Comment

                        Working...
                        X