Partitioning at installation / upgrade

Congratulations on the Leap 15.2 release! You guys are terrific.

I wonder if someone can give me advice about partitioning my system, starting from the following conditions:

The idea was to UPGRADE to Leap 15.2 from 15.1. However, for some reason that I cannot remember, I notice that my desktop configuration has 2 BrtFS partitions: sda2 with 40 GiB and sda3 with 180 GiB (swap is registered as sda1 with 2 GiB). Leap 15.1 is installed on sda3, sda2 is not mounted and there is no space behind it, so at the moment 40 GiB are totally wasted. I now want to use the whole 220 GiB for the Leap 15.2 upgrade.

What is a safe procedure for achieving this, assuming that I want to upgrade to 15.2 rather than make a new installation?

Maybe show us rather then tell us.

cat /etc/fstab could be helpful to see what is mounted where. Please use code tags around computer text

if sda2 is not mounted you can mount it at some point in home and use that space. You would need a new install and and repartitioning to totally fix it.

The new defaults are now to have /home on the root partition as a sub volume IMHO this is a backward step having separate home partition allow much more flexibility when upgrading and or changing distros keeping personal and system data separated.

Please show the result of:

fdisk -l

so that we can see what your disk really looks like.
If your description is accurate I see no easy way to reclaim those 40 GB without reformatting and reinstalling.
Maybe if you have a spare disk of the same size there is a way of copying your 180GB partition at the beginning of the spare disk and then enlarge it as needed or something like that.

cat /etc/fstab
UUID=357c1741-159a-4cb7-ac75-bc52d06c06d4  /                       btrfs  defaults                      0  0
UUID=357c1741-159a-4cb7-ac75-bc52d06c06d4  /var                    btrfs  subvol=/@/var                 0  0
UUID=357c1741-159a-4cb7-ac75-bc52d06c06d4  /usr/local              btrfs  subvol=/@/usr/local           0  0
UUID=357c1741-159a-4cb7-ac75-bc52d06c06d4  /tmp                    btrfs  subvol=/@/tmp                 0  0
UUID=357c1741-159a-4cb7-ac75-bc52d06c06d4  /srv                    btrfs  subvol=/@/srv                 0  0
UUID=357c1741-159a-4cb7-ac75-bc52d06c06d4  /root                   btrfs  subvol=/@/root                0  0
UUID=357c1741-159a-4cb7-ac75-bc52d06c06d4  /opt                    btrfs  subvol=/@/opt                 0  0
UUID=357c1741-159a-4cb7-ac75-bc52d06c06d4  /home                   btrfs  subvol=/@/home                0  0
UUID=357c1741-159a-4cb7-ac75-bc52d06c06d4  /boot/grub2/x86_64-efi  btrfs  subvol=/@/boot/grub2/x86_64-efi  0  0
UUID=357c1741-159a-4cb7-ac75-bc52d06c06d4  /boot/grub2/i386-pc     btrfs  subvol=/@/boot/grub2/i386-pc  0  0
UUID=67d97dbf-fe17-45e2-9144-6afb0bb64232  swap                    swap   defaults                      0  0
UUID=357c1741-159a-4cb7-ac75-bc52d06c06d4  /.snapshots             btrfs  subvol=/@/.snapshots          0  0


fdisk -l
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Disk model: KINGSTON SUV400S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x000e7a08

Device     Boot    Start       End   Sectors   Size Id Type
/dev/sda1           2048   4208639   4206592     2G 82 Linux swap / Solaris
/dev/sda3       88100864 468862127 380761264 181.6G 83 Linux

Thanks for your help. In the meantime, I deleted sda2 with the partitioner, so both outputs above is the state after the deletion.

AFAIK there is no way to shift a BTRFS partition backwards to the beginning of the disk, so the only way I see without reinstalling from scratch is backing up the 180GB partition somewhere, reformatting, restoring the partition and then growing it to fill all available space.
Please be careful, with that setup if you do a clean install you lose all your /home contents, so make sure to have a good backup handy before doing anything on that disk.

You may add a new device and remove the old device: “btrfs device add …”.

I had a feeling I might have to start from scratch. Is there a recommended partitioning scheme? 40 GiB (btrfs) is apparently not enough for / Leap 15.2.

If you are using “btrfs”, then I would suggest at least 50G for the root partition. However, 40G should be plenty if you go with “ext4” for the file system.

That’s news to me that a BTRFS partition can’t be moved and expanded to include the unformatted, unpartitioned free space.
You can try doing what you need u sing the YaST partitioner, if you try to do something that isn’t permitted, you’ll be prevented from doing it.

Because this is your root partition and not a data partition, changes sometimes can’t be applied until you reboot.
Also, my personal SOP is to not use a tool on my actively used partition (can be a recipe for disaster), I instead prefer to download GParted Live and run it from a CD or USB stick. it hasn’t failed me once in many, many years.

As always, no matter the success rate, either backup or copy everything you value before tampering with low level functionality like partitions and file systems, if you damage your system you may be left trying to recover data and that can be problematic.

BTW -
Of course I assume you don’t have any encrypted file systems and if you have that, then you first have to unencrypt everything and turn the encryption off…

Good Luck,
TSU

Despite recommendations, my personal SOP is to hardly ever install BTRFS on a partition less than 100GB to be certain I have plenty of space for snapshots. If you install on a 49GB or smaller partition, first your /home would not be on a separate subvolume or partition, it would be in the same volume and partition as your system root, and even then I would highly recommend disabling snapshots.

I suppose if you migrated or re-installed on ext4, it’d be the same regarding snapshots… none unless you go out of your way to install and configure that capability.

TSU

I don’t think snapper works on ext4. I know they were trying to get to work but never heard it did.

default these days is /home as a sub volume of root rather on a separate partition. so you must allow for all you intend to use /home for ie your personal stuff. the default system will be less then 15 gig depending on what programs you install. Depending on personal usage you can easily eat up 20 more gig on home and that is not counting snapper

Personally I use ext4 on a 30 gig partition on a small ssd and home on full 1tb ssd with a small partition for swap. I do run Windows but in VirtualBox. I’m booting using MBR mainly for historical reasons.

I’m not a regular BTRFS user so I might be mistaken, but reading

man btrfs-filesystem

I see no option to move backwards an already created filesystem, only grow it to fill the existing partition, or shrink it (and please read the notes about the underlying partition).
It should be possible to add a new device though, as @karlmistelberger pointed out in post #6.

moving a partition is independent from the FS type since it just does a binary copy and FS addressing is relative to the partition not the disk. Resizing can be tricky since it can depend on the FS. Such as xfs which can not be reduced in size. In any case after a resize of partition the FS may need tweaked to allow for the new environment. This is generally done by the actual utility you use to move/resize if it understands the FS involved

This is the way I went and it was successful! I trusted Gparted (started from a boot system) to stop me if I tried anything illegal. I moved the sda3 partition with Gparted successfully to the left (after back-up, of course), restarted the 15.1 system just to check that it was successful and then rebooted to upgrade to 15.2. All successful (almost, but that is another post:), so **many thanks for the help:)
**

Nice to know. The YaST Partitioner refuses to move partitions with a filesystem already created:
https://susepaste.org/view/raw/82957732
Apparently GParted uses a smarter plugin, possibly making a byte-for-byte copy in stages until the whole partition is moved.

AH! This was why on ‘upgrade’ from 15.1 t0 15.2 I only got a “/” partition as well as separate problems on screen nvdia nouveaux needed & solved]
Using ONLY “/” is a big retrograde step, as preservation of a separate “/home” partition is a very necessary thing when upgrading or re-installing. This is my personal opinion having multiple machines where “/home” is preserved when upgrading or if necessary re-installing.

Personally, I agree. But there are different opinions on this.

In any case, when the installer make a partitioning proposal, click on “Guided setup”. Having a separate “/home” is still an option there, and if you select that it will give a revised partitioning proposal which does have a separate “/home”.

Arch and Manjaro use Timeshift to do snapshots on EXT4.
Timeshift is available in our OSS.

I’ve never run it on openSUSE, though.
Note that unlike Snapper, Timeshift seems to be just the functionality (like what is provided in BTRFS) and not the configuration. Once installed, Timeshift still needs to be enabled and configured.

If you’re still a big user of EXT4, maybe this is worth looking into more deeply to give you that extra recovery option.

TSU

I think moving the partition has been blocked intentionally. Unintentionally interrupting the move results in disaster.

You can only move to unused adjacent areas. If a partition exits immediately before or after the partition you can not move in such a way as to overwrite the adjacent one.