Btrfs: Difference between revisions

Ponder (talk | contribs)
m Usage: Copyedit incl combine short paras
Ponder (talk | contribs)
Line 285: Line 285:
</div>
</div>


To convert the existing filesystem (Ext3/4) to Btrfs, boot into a NixOS live system and run following command<syntaxhighlight lang="sh">
To convert the existing filesystem (Ext3/4) to Btrfs, boot into a NixOS live system and run the following commandː<syntaxhighlight lang="sh">
fsck -f /dev/sdXY
fsck -f /dev/sdXY
btrfs-convert /dev/sdXY
btrfs-convert /dev/sdXY
</syntaxhighlight>Replace the device path with the target partition. Converting larger filesystems can take a long time.
</syntaxhighlight>Replace the device path with the target partition. Converting larger filesystems can take a long time.


Next, mount the converted filesystem and chroot into it<syntaxhighlight lang="sh">
Next, mount the converted filesystem and chroot into itː<syntaxhighlight lang="sh">
mount /dev/sdXY /mnt
mount /dev/sdXY /mnt
nixos-enter --root /mnt
nixos-enter --root /mnt
Line 301: Line 301:
</syntaxhighlight>Apply the changes<syntaxhighlight lang="sh">
</syntaxhighlight>Apply the changes<syntaxhighlight lang="sh">
nixos-rebuild boot
nixos-rebuild boot
</syntaxhighlight>In case Grub bootloader is used and it doesn't get reinstalled correctly, you can run following command inside chroot<syntaxhighlight lang="sh">
</syntaxhighlight>If the Grub bootloader is used and it doesn't get reinstalled correctly, you can run the following command inside chrootː<syntaxhighlight lang="sh">
grub-install /dev/sdX
grub-install /dev/sdX
</syntaxhighlight>If the conversion went successful and no rollback is required, the backup image which was stored by btrfs-convert can be removed with<syntaxhighlight lang="sh">
</syntaxhighlight>If the conversion was successful and no rollback is required, the backup image which was stored by btrfs-convert can be removed withː<syntaxhighlight lang="sh">
btrfs subvolume delete /btrfs/ext2_saved
btrfs subvolume delete /btrfs/ext2_saved
</syntaxhighlight>
</syntaxhighlight>
[[Category: Configuration]]
[[Category: Configuration]]
[[Category:Filesystem]]
[[Category:Filesystem]]