Ok, here’s the situation: I have a 1TB SSD /dev/sda. This used to have two partitions, /dev/sda1 - NTFS as a data disk for my windows install, and /dev/sda2 - btrfs as my /home on Linux.
Since I rarely, if ever, boot to Windows I have moved the data from /dev/sda1 to one of my iscsi targets and updated Windows to look at the proper places. I then deleted the ntfs partition /dev/sda1 from the SSD.
Now I want to have Linux use the entire disk for /home. It is currently mounted as a /@home subvolume with snapshots and I preferable would not want to lose anything. I do have space to move data around and already made a tar archive of the entire /home mountpoint.
How would I go about increasing the size of the home partition to the entire disk? I could just wipe the disk, reformat, remount and extract my tar archive but I’d have setup snapshots again lose the snapshots I had. Is there some other way, considering the current partition lives somewhere in the middle of the disk?
What you show now is not vague *), but a bit malformed. Please next time select the computer text in your post and then use the </> button in the tool bar at the top of the post editor. Then we will see what you see. And also we prefer it very much that you include the command that creates the output within the copy/paste. It is only one more line at the beginning (and adding the new prompt at the end then will signal that t is all complete).
Example: not
5.14.21-150400.24.69-default
but
There are of course several ways to do this and I have no doubt others will come with their favorite solutions.
What I probably would do:
go into multi-user target and log in as root on the console;
create sda1 from the begin of the disk with exact the same size as sda2 is now;
move the contents of sda2 to sda1 (with something like dd if=/dev/sda2 of=/dev/sda1);
remove sda2;
increase the size of sda1 with the rest of what is available;
increase the Btrfs file system to fit the partition;
change /etc/fstab so it points to the new place where the file system is now (when the UUID is used, change to the UUID of the now sda1);
back to graphical target or reboot;
keep my fingers crossed.
As I am not a Btrfs user, please check first if you can increase a Btrfs file system (not all file system types allow this).
=========
*)
We in fact do not trust any stories with conclusions, we only trust what the computer tells you and us.
For this particular case, we have seen here someone who confused his Btrfs /home sub-volume with a separate Btrfs file system. Tooks days before all was sorted out.
Also, having a separate /home on Btrfs is not much seen and many people here doubt the merits of such a construct.
Thanks, will try keep that in mind. Keeps things readable indeed.
It seems you can, it has a resize feature and not necessarily intended for this use case, hence the question.
As for merits: it may not have real ones, but for me keeping all filesystems the same keeps things simple and having the ability to schedule hourly snapshots that essentially don’t take up very little space is pretty good for covering my own behind from certain PICNIC errors occurring. Well maybe not occurring, but definitely recovery from said PICNIC errors.
My text about the merits of Btrfs for /home was not so much trying to make you explaining why (I assume you have some reason for it), but to make clear that your initial story may rouse suspicion about what you really have.
With btrfs you can simply replace device sda2 with sda1 and btrfs will copy only user data (not empty space) and remove sda2 from filesystem when copy is complete. And it is done online.
I actually just finished using the old-fashioned way of doing things, which worked. However it takes looong (maybe should have specified block size) and for posterity and the search results the more modern, BTRFS way of doing things should probably be in here as well. Plus, I can reference this thread myself next time I need to do something similar.
The man page for btrfs references 19 other manpages related to btrfs functions and operations, as well as a link to the latest/current documentation. Having documentation available is rarely an issue with Linux. Knowing where to look in said documentation in order to find what you are looking for is quite often a different story.
On a personal level, I don’t mind a bit of reading so a reference to a specific piece of documentation that describes what I need to know to resolve my issue is as much appreciated as the solution itself.
Circling back to the question, I did notice btrfs-replace and read its manpage. However, that page implies physical devices not partitions. Maybe I was too quick drawing conclusions, but I tend to err on the side of caution when it comes to data.