Convert Ubuntu 18.04 install to BTRFS

  • Anyone know how to convert EXT4 in Ubuntu 18.04 to something like BTRFS so I can have file compression on the OS files? Anyway to do with a live system too?


    Would make sense if the Netcup installed images had this set by default really....

  • Not sure if it's feasible to do the conversion on an existing system.


    As far as clean installs go, you can mount the Ubuntu live ISO and go through the installation on your own, there you can also create your custom partition layout.

  • Not sure if it's feasible to do the conversion on an existing system.


    As far as clean installs go, you can mount the Ubuntu live ISO and go through the installation on your own, there you can also create your custom partition layout.


    Could I not boot the installation ISO and then use that to do the modification to my existing install with the fstransform tool and (presumably) editting the fstab after that ?? Seems theoretically possible but I'd not be confident and dont want to trash a system I use daily!

  • Could I not boot the installation ISO and then use that to do the modification to my existing install with the fstransform tool and (presumably) editting the fstab after that ?? Seems theoretically possible but I'd not be confident and dont want to trash a system I use daily!

    Depending on the available space, you should have the option to create a snapshot of your system and restore the latter in case of problems. (I'd test the restore functionality first, though.)

    Better yet, you could export a snapshot of your entire system (the first export is free, you'd pay for subsequent exports like this) and download, import it at home or use another VPS which can be rented on an hourly basis to run your tests.

    VServer IOPS Comparison Sheet: https://docs.google.com/spreadsheets/d/1w38zM0Bwbd4VdDCQoi1buo2I-zpwg8e0wVzFGSPh3iE/edit?usp=sharing

    Danke 1
  • The end of standard support of Ubuntu 18.04.6 LTS will be in June of 2023, so in about 3 months (!) ( https://wiki.ubuntu.com/Releases )


    "Extended Security Maintenance" will be available until April 2028, but you will need a subscription for this. Not having such a subscription will be the same as using an unpatched system for months and years on the internet. A system which will be taken over.


    Ubuntu 22.04.2 will have standard support until April 2027. So if you want to have BTRFS and at the same time secure your server, this would be the right opportunity to backup and reinstall.

    RS Ostern L OST22 (~RS "3000" G9.5) (8C,24GB,960GB) | RS Cyber Quack (1C,2GB,40GB)

    Gefällt mir 1
  • The end of standard support of Ubuntu 18.04.6 LTS will be in June of 2023, so in about 3 months (!) ( https://wiki.ubuntu.com/Releases )


    "Extended Security Maintenance" will be available until April 2028, but you will need a subscription for this. Not having such a subscription will be the same as using an unpatched system for months and years on the internet. A system which will be taken over.


    Ubuntu 22.04.2 will have standard support until April 2027. So if you want to have BTRFS and at the same time secure your server, this would be the right opportunity to backup and reinstall.


    Interesting but not relevant when my application does NOT run on 22.04 or 20.04... :(

  • Interesting but not relevant when my application does NOT run on 22.04 or 20.04... :(

    If its not running on the newer versions of ubuntu there should be a reason for it.


    To change the filesystem you can boot into a live OS and make the conversion on the ext4 volume.


    and for your application you could check if there is a docker image for it or just run it in a virtual machine

  • Interesting but not relevant when my application does NOT run on 22.04 or 20.04... :(

    Then the application should not run at all on an internet server, starting June 2023. Simple as that.


    Reminder: you are legally responsible for everything coming from your (hacked) server.

    RS Ostern L OST22 (~RS "3000" G9.5) (8C,24GB,960GB) | RS Cyber Quack (1C,2GB,40GB)

    2 Mal editiert, zuletzt von TBT ()

  • Done. Wasn't difficult and didnt need the backup partition AND snapshot I took just in case. In short:


    Boot Gparted Live CD

    Shrink sda2 down from 1Gb to 200MB [ was using under 100MB so reclaimed that space)

    Resize/move sda3 to make space to create sda4 for backup [ wasn't needed, just resize to gain the 800MB from above]


    Boot Ubuntu 20.04 LiveCD

    At installer Ctrl-Alt-F2-F6 to drop to tty

    sudo -s


    -------not needed--------

    mkdir /home/old

    mkdir /home/new

    mount /dev/sda3 /home/old

    mount /dev/sda4 /home/new

    rsync -avxHAX --progress /home/old/ /home/new/

    -------not needed--------


    apt update && install fstransform

    fstransform /dev/sda3 btrfs --force-untested-file-systems

    blkid /dev/sda3 [get UUID for fstab]

    nano /etc/fstab

    [fix root entry ] UUID=xxxxxxxxxxxxxxxxx / btrfs compress=zstd 0 0

    mount /dev/sda3 /mnt

    mount --bind /dev /mnt/dev

    mount --bind /proc /mnt/proc

    mount --bind /sys /mnt/sys

    chroot /mnt

    mount /dev/sda2 /boot

    update-initramfs -u

    update-grub

    reboot


    All should be done, but then


    btrfs filesystem defragment -r -v -czstd / [FORCES RECOMPRESSION]