How to bypass disk format for btrfs subvolume installation

Write tutorials for LMDE here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post please read forum rules
Post Reply
InvisibleRasta
Level 1
Level 1
Posts: 15
Joined: Mon Apr 01, 2024 9:50 am

How to bypass disk format for btrfs subvolume installation

Post by InvisibleRasta »

Hey folks,

I wanted to share a simple method I've been using to install Linux Mint on Btrfs subvolumes without needing to format the Btrfs partition. This method is particularly handy if you have multiple subvolumes on your partition and don't want to spend time moving large amounts of data to other disks or partitions.
While there are YouTube videos and guides out there, I've found them to be overly complicated. So, I'm here to show you an easier way to install LMDE/Linux Mint on btrfs subvolumes without formatting with just four simple commands.

DISCLAIMER: Ensure that if you have any other Linux distribution installed on the same partition, it doesn't already have two subvolumes named @ and @home. The Linux Mint installer will overwrite these subvolumes if they already exist. If you do have them, rename them to something else like '@gentoo' and '@gentoo-home'.


Explanation: Firstly, we backup mkfs.btrfs (the executable used to format a disk to Btrfs). Since we already have a Btrfs partition and we don't want the installer to format it, we replace the mkfs.btrfs executable with /bin/true, which is a command that returns 0 (a truth value in the shell). This tricks the installer into thinking that it formatted the partition and allows the installation to continue.



1. Select "Manual Partitioning" and configure your partitions as shown in the screenshots below.


Image

Image

2. By default, the installer won't let you install into a partition without formatting. To bypass this, instruct the installer to format the partition (don't worry, it won't actually format anything).

Image

3. Once you reach this point, we will do some magic to ensure that the installer won't format the disk.

Image

4. Before confirming the entered data to start the installation process, open a terminal and execute the following commands:

Code: Select all

       sudo su -
       cd /sbin
       mv mkfs.btrfs mkfs.btrfs.BAK
       ln -s ../bin/true mkfs.btrfs



Image

MAKE SURE TO TYPE EVERYTHING EXACTLY AS SHOWN.

:D Now you can proceed with the installation. :D
Just remember to read the disclaimer, as this process will overwrite any subvolumes named @ and @home because the Linux Mint installer uses these two subvolumes to install.
Last edited by SMG on Thu Apr 04, 2024 5:57 pm, edited 1 time in total.
Reason: Moved from Chat about Linux Mint to LMDE:Tutorials because this is a how-to guide.
Post Reply

Return to “Tutorials”