Announcement

Collapse
No announcement yet.

Using BTRFS on a USB drive to expand temporarily expand available space - another example of the power of BTRFS

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

    Using BTRFS on a USB drive to expand temporarily expand available space - another example of the power of BTRFS

    Warning: *** DO NOT do anything like this without a backup! ***


    The situation:
    Kubuntu 20.04 installed to a 15GB BTRFS partition.
    After removing/cleaning as much as I could, I had only 6GB of available space.
    The dist-upgrade to 22.04 required 10GB of free space.

    The concerns:
    There was no easy access to unused space on the drive as Windows had most of it.
    Resizing and moving partitions is difficult, time consuming, and dangerous to your data.

    One solution would have been to just wipe it and install 22.04, but this seemed like defeat.

    Here's what I did instead:

    Inserted a 64GB USB thumb drive into the computer.
    When formatted with BTRFS the USB drive had 58GB of usable data space.
    Added it to the existing BTRFS install partition with:

    sudo btrfs add /dev/sdb1 /

    This resulted in 64GB of free space on /
    I then started the dist-upgrade and let it finish (about an hour)

    After rebooting into the new 22.04 install, I removed the USB drive from the BTRFS with:

    sudo btrfs remove /dev/sdb1 /

    and rebooted again to verify all is well. I now have a 22.04 install with 4GB available!
    Last edited by Snowhog; Oct 12, 2023, 11:08 AM.

    Please Read Me

    #2
    Very clever use of btrfs. I had no idea you could do that with just btrfs and not something like lvm.

    Comment


      #3
      Awesome and easy!

      I have a 500GB SSD and am considering replacing it with a 1 or 2 TB SSD. IF I do that I will use btrfs-replace.
      "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


        #4
        Originally posted by jfabernathy View Post
        Very clever use of btrfs. I had no idea you could do that with just btrfs and not something like lvm.
        And it was super simple and quick AND totally safe - as long as you don't yank the USB drive out or have a glitch causing it to disconnect. The computer in question did have available drive slots so I could have added an additional drive, but using the USB stick meant I didn't even have to power down.

        Please Read Me

        Comment


          #5
          Originally posted by GreyGeek View Post
          Awesome and easy!

          I have a 500GB SSD and am considering replacing it with a 1 or 2 TB SSD. IF I do that I will use btrfs-replace.
          IIRC, that's a relatively new command. I'm curious how long it will take. The last time I replaced a drive in my server (several years ago) I added the new drive to the file system, then used the "balance" command to relocate all the data onto the new drive. At the time about 8TB of data and it took more than 24hrs. Those were platter drives tho so I doubt your change over will take anything like that much time.

          he next time I need to replace a server drive it will be SSDs, since they're now almost affordable. About $20 a TB for large platter drives and $43 for large SSDs. Two 8TB Samsung SSDs would be about $725 vs. $320 for a high performance platter drive suitable for a server - OK, so not really "affordable" LOL

          Please Read Me

          Comment


            #6
            I bought this in preparation for my conversion from 500GB to 1TB, and it was only $49.99.
            SAMSUNG 870 EVO SATA III SSD 1TB 2.5” Internal Solid State Drive, Upgrade PC or Laptop Memory and Storage for IT Pros, Creators, Everyday Users, MZ-77E1T0B/AM
            The 2TB was $135 and the 4TB was $225
            8TB is both too large and too far out of my "affordable" zone, to say nothing of two of them! I really don't know what I'd do with 8 or 16TB of space. I haven't modeled any data since the pandemic went away, except for the Cassini flyby.

            The user experience with BTRFS-Replace claims it is much faster than adding and removing a device.

            https://wiki.tnonline.net/w/Btrfs/Replacing_a_disk
            btrfs replace is the preferred method of replacing a disk in a btrfs filesystem, especially when there is a damaged or missing device. While btrfs device add + btrfs device remove also works, it is a much slower method and can cause issues if there are read/write errors. btrfs replace is not only faster, it handles failures and errors better.​


            PS- My problem is that I have only one IDE SATA port internally on this HP 17-cn00* laptop.
            So, I'll have to plug the new SSD into a USB port to format it and run the btrfs-replace command. If I understand that command properly I'll then be running my system off of the USB port where the new SSD is plugged in. After it is done I'll check the fstab file to make sure the UUID of the new SSD is in the line that mounts to "/". Then I'd shut down the computer, pull the old SSD out of the internal IDE SATA socket and replace it with the new SSD from the USB port and reboot. IF that works then all is well in the garden. IF it doesn't work (boot flag, gpt, efi, ) then I may be forced to reformat the new SSD as it sets in the internal IDE socket and do the copy game to bring my data up to date.
            Last edited by GreyGeek; Oct 13, 2023, 04:07 PM.
            "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

            Working...
            X