[{"content":"As I still get questions from my friend on how to use ntfs2btrfs, I decided to condense everything in a blog post (because I hate repeating myself too many times).\nInstalling ntfs2btrfs This is probably the easy part: there\u0026rsquo;s a package of it on just every major repo.\nJust install it like so:\nDebian and Ubuntu: sudo apt install ntfs2btrfs Arch: sudo pacman -Syu ntfs2btrfs Fedora: sudo dnf install ntfs2btrfs Or, if not available, download and compile it from the repo.\nUsing ntfs2btrfs A word of warning: while the script has worked fine for two of my disks without data losses: please, for the love of god, backup your truly important data. You\u0026rsquo;ve been warned.\nWhile your disk is unmounted (you can do that from your file manager by right clicking the drive), just call the program like so sudo ntfs2btrfs /dev/sda1.\nObviously, you need to replace /dev/sda1 with your correct drive: with a simple lsblk, you can print all your drives and their device name.\nFor example, this is the output from my PC:\n❯ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 1,8T 0 disk └─sda1 8:1 0 1,8T 0 part /media/hdd sdb 8:16 0 465,8G 0 disk └─sdb1 8:17 0 465,8G 0 part /media/ssd zram0 253:0 0 15,5G 0 disk [SWAP] nvme0n1 259:0 0 465,8G 0 disk ├─nvme0n1p1 259:1 0 2G 0 part /boot └─nvme0n1p2 259:2 0 463,8G 0 part /var/cache /var/log /var/tmp /srv /root /home / Let\u0026rsquo;s say i want to convert my 465G drive (my very slow SATA ssd), i would call ntfs2btrfs like so sudo ntfs2btrfs /dev/sdb1.\nWaiting This conversion does take a while, and you will probably notice some warnings about files with extended permission not being supported: they are completely safe to ignore, as the data will get carried around, just without those extra permissions.\nProfit Congrats, you now have converted your drive to BTRFS! But are we truly done?\nSpace cache v2 \u0026amp; block group tree This script is really nifty, but it doesn\u0026rsquo;t enable space cache v2 and block group tree: in short, if you have a slow and big drive (for example, a 2TB HDD), without this it will take a lot of time to mount your drive. And the boot process could even fail, because timeouts (ask me how I know lol).\nHow to convert to it Firstly, I will assume you know how to mount your disk normally (see the CachyOS wiki if you don\u0026rsquo;t know how).\nYou will need to simply mount your drive with space_cache=v2 as an additional parameter.\nFor example, for my HDD I would have to go from this\nUUID=1554bd55-3b4f-f451-bcd3-b00f3f847e27 /media/hdd btrfs defaults,noatime,commit=120 0 0 to this\nUUID=1554bd55-3b4f-f451-bcd3-b00f3f847e27 /media/hdd btrfs defaults,noatime,commit=120,space_cache=v2 0 0 Then just do sudo systemctl daemon-reload and sudo mount -a.\nNow, unmount your drive again and run\nsudo btrfstune --convert-to-block-group-tree /dev/sda1 If you don\u0026rsquo;t have btrfstune, you\u0026rsquo;re probably missing the package btrfs-progs\nThen, you\u0026rsquo;re done and you can just sudo mount -a your drives again!\nCompression BTRFS supports file compression: this is huge for things like your game drives, as some older games don\u0026rsquo;t employ asset compression and compressing them will save you some space.\nTo enable it, just add compress=zstd to your mount parameters like so:\nUUID=1554bd55-3b4f-f451-bcd3-b00f3f847e27 /media/hdd btrfs defaults,noatime,commit=120,space_cache=v2,compress=zstd 0 0 And then, again, remount your drive with sudo systemctl daemon-reload and sudo mount -a.\nCongrats, you now have enabled compression for your written files from now on!\nCompressing already existing files For your already existing files, you\u0026rsquo;ve got to use the defragment utility of btrfs while the drive is mounted.\nBe warned that this process will take a lot of time, as it has to read and write each file that needs to be compressed.\nsudo btrfs -v filesystem defragment -r -czstd /mnt/hdd Checking savings There\u0026rsquo;s compsize that accept as a parameter a folder or file on a BTRFS drive, and it will tell you it\u0026rsquo;s disk usage and compression ratio. Taking as an example my Payday 2 folder\n❯ sudo compsize \u0026#34;/media/hdd/Giochi/Steam/steamapps/common/PAYDAY 2/\u0026#34; Processed 13683 files, 663952 regular extents (663952 refs), 7252 inline. Type Perc Disk Usage Uncompressed Referenced TOTAL 61% 52G 85G 85G none 100% 6.1G 6.1G 6.1G zstd 59% 46G 79G 79G you can see that\u0026rsquo;s quite the saving: 33G!\nSome notes about compression The algorithm I used in this article, zstd, is really fast: in it\u0026rsquo;s default state, it uses a compression level of 3. You shouldn\u0026rsquo;t be worrying about perfomance losses.\nBut if you really, really think that you have a potato PC, you can switch from zstd to lzo by just changing it in the /etc/fstab and in the filesystem defragment command. Be warned that it achieves worse compression ratios though!\n","permalink":"https://blog.thetipo.eu/posts/ntfs2btrfs/","summary":"\u003cp\u003eAs I still get questions from my friend on how to use ntfs2btrfs, I decided to condense everything in a blog post (because I hate repeating myself too many times).\u003c/p\u003e\n\u003ch1 id=\"installing-ntfs2btrfs\"\u003eInstalling ntfs2btrfs\u003c/h1\u003e\n\u003cp\u003eThis is probably the easy part: there\u0026rsquo;s a package of it on just every major repo.\u003c/p\u003e\n\u003cp\u003eJust install it like so:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eDebian and Ubuntu: \u003ccode\u003esudo apt install ntfs2btrfs\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eArch: \u003ccode\u003esudo pacman -Syu ntfs2btrfs\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eFedora: \u003ccode\u003esudo dnf install ntfs2btrfs\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eOr, if not available, download and compile it from the \u003ca href=\"https://github.com/maharmstone/ntfs2btrfs\"\u003erepo\u003c/a\u003e.\u003c/p\u003e","title":"How to use ntfs2btrfs, convert to space_cache v2 and enable BTRFS compression"},{"content":"So, what happened today?\nThe server decided to disconnect itself from my network. This is not the first time it happened, I\u0026rsquo;m starting to think the ethernet cable I ran through the walls has some problems.\nAnyway, a reboot fixed everything.\n","permalink":"https://blog.thetipo.eu/posts/downtime-2023-09-30/","summary":"\u003cp\u003eSo, what happened today?\u003c/p\u003e\n\u003cp\u003eThe server decided to disconnect itself from my network. This is not the first time it\nhappened, I\u0026rsquo;m starting to think the ethernet cable I ran through the walls has some problems.\u003c/p\u003e\n\u003cp\u003eAnyway, a reboot fixed everything.\u003c/p\u003e","title":"Downtime 2023-09-30"}]