Can I safely downsize ext4 partition prior to backup?

I recently found out, that my main ssd has a bad sector, so I am planning to refund it, but prior to that, I want to backup my data on an ssd. The main ssd is 2TB, but is far from full, I want to downsize my /home partition to less or equal to 512 GB.

68.5GiB (btrfs snapshots,and all the boot partitions)+ 22% of 1.75TiB (let’s say 23 for headroom) = 471 GiB < 476.83 GiB

I did it with gparted before on other distros, is it reasonable with opensuse too?

Show lsblk -f and explain again, the above is not clear to me.

baboon@localhost:~> lsblk -f
NAME FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
nvme0n1
│                                                                           
├─nvme0n1p1
│    vfat   FAT32       4426-93F1                               505M     1% /boot/efi
├─nvme0n1p2
│    btrfs              acd2f8fe-6cfd-4778-92db-c1cddff97ba1   28.5G    49% /var
│                                                                           /usr/local
│                                                                           /srv
│                                                                           /root
│                                                                           /opt
│                                                                           /boot/grub2/x86_64-efi
│                                                                           /boot/grub2/i386-pc
│                                                                           /.snapshots
│                                                                           /
├─nvme0n1p3
│    swap   1           5c8aea34-e8e4-4814-94cc-9f3f01b62afc                [SWAP]
└─nvme0n1p4
     ext4   1.0         a55e33df-9c99-4471-960b-5217f490bb07    1.3T    17% /home
baboon@localhost:~>

In short, can i shrink down nvme0n1p4 such that i can fit the whole opensuse install onto a 512GB disk?

A backup, only backups data, not empty space. So it is absolutely no problem to fit your ~250G data into a 500G drive. No resizing of partitions needed.

Cloning a drive is a different topic. There you usually need the same source and target SSD size (depending on technique and tools used)

So what do you want to achive?

I want to clone my drive, thats why i am talking about downsizing partitions

That is why i asked. Your opening post said:

The shrinking of the home partition should work in theory. Backup your home partition as there is never a guaranty that you won’t lose data. Use a tool which can shrink the size whilst keeping the data, e.g. gparted.

The home partition shouldn’t be in use whilst the operation is ongoing. So use a live OS at best.

In the worst case that something goes wrong whilst shrinking, you can copy the data from your backup to the shrinked home partition.

1 Like