move root partition (existing installation) to btrfs

  • Disclaimer: Do it on your own risk. I only tried this in a virtual machine.


    Hi there.
    I'm trying to figure out how to move an existing installation to btrfs to use apt-btrfs-snapshot.
    apt-btrfs-snapshot creates a snapshot every time you run apt to install something. This also works if you install software through GUI.
    After moving to btrfs you can also create snapshots manually before you try out something.


    All commands in the guid have to be called from a linux live system.
    In my case I used kubuntu 17.04. sda is the existing OMV3 installation on ext4.
    I used the command btrfs-convert despite warnings you get all over the place.
    In production you might copy files around to a second drive and create a fresh brtfs partition.


    So far I succeeded inside a virtual machine. My question is.. did I miss something?


    Here comes the guide:

    Einmal editiert, zuletzt von mehlbox () aus folgendem Grund: slight changes in code

  • I now successfully applied this to a debian machine. It worked out pretty well. I damaged my system on purpose and did a rollback without the need of live linux.


    Get apt-btrfs-snapshot like mentioned in my post before

    Code
    # install apt-btrfs-snapshot
    wget https://ftp.fau.de/ubuntu/pool/universe/a/apt-btrfs-snapshot/apt-btrfs-snapshot_3.5.1_all.deb
    dpkg -i apt-btrfs-snapshot_3.5.1_all.deb
    rm apt-btrfs-snapshot_3.5.1_all.deb


    Backup and rollbacks:
    Backup is being performed live.

    Backups can be done by cron on a regular base. This works instantly. Takes not even a second.
    Without configuration Backups are done every time apt is installing something.




    you might clean up your old root after conversion since it is not used anymore.

    Code
    # clean up old root
    mount /dev/sda2 /mnt
    cd /mnt
    rm bin
    rm dev
    rm etc
    rm usr
    and so on....
    btrfs sub del /mnt/ext2_saved  # no rollback to ext4 possible after this operation
    btrfs balance start /          # no rollback to ext4 possible after this operation



    There are still question marks left...

    • Does anyone know what's wrong about btrfs-convert? There is a warning on the wiki page. So far it worked out for me.
    • apt-btrfs-snapshot_xxx.deb is written for ubuntu. I guess I'm not the only one to use a ubuntu package in debian. Just worth to mention.
    • Offizieller Beitrag

    I used this years ago. I can't remember what was wrong with ext4 conversion but never had issue, anyhow you can still move the data somewhere else and do a native format of you want.

  • Concerning btrfs-convert I found on the mailing list:

    AFAIK, there are quite number of people converted their EXT4 to BTRFS .IMO, btrfs-convert is fairly stable, especially if you have only GB's of data

    and

    It has been recently (btrfs-progs 4.6) rewritten nearly from scratch. Thiswas a year ago and from the lack of complaints recently it sounds like anymajor bugs should be ironed out -- assuming you're using a version of -progsnew enough.


    This has been discussed just recently (22 Jun 2017)... maybe there is more to come from others...

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!