0

I'm trying to shrink my btrfs 900Gib HDD down to 500Gib so that I can transfer it using clonezilla to my new 500 Gib SSD.

I thought that I could just shrink down the partition using gparted, but it fails with this error:

GParted 0.30.0 --enable-libparted-dmraid --enable-online-resize

Libparted 3.2
Shrink /dev/sda2 from 931.01 GiB to 406.71 GiB  01:20:34    ( ERROR )

calibrate /dev/sda2  00:00:01    ( SUCCESS )

path: /dev/sda2 (partition)
start: 1050624
end: 1953519615
size: 1952468992 (931.01 GiB)
shrink file system  01:20:33    ( ERROR )

btrfs filesystem resize 1:426467328K '/mnt'  01:20:33    ( ERROR )

Resize '/mnt' of '1:426467328K'
ERROR: unable to resize '/mnt': No space left on device

========================================

This also occurs when I try and resize from 470GiB -> 433GiB. I don't believe that it can run out of space on the disk as there is 497GiB. Gparted

This was performed on an unencrypted home folder from the kubuntu 18.04.01 live usb.

EDIT 0: Output of sudo filesystem show /mnt (Which is where I have

/dev/sda2 mounted)
kubuntu@kubuntu:~$ sudo btrfs filesystem show /mnt
Label: none  uuid: 029c3c88-8edb-4da0-a741-5d912950e2e1
        Total devices 1 FS bytes used 406.61GiB
        devid    1 size 473.68GiB used 461.10GiB path /dev/sda2
Sarah Szabo
  • 1,493
  • As you attempting to resize a partition whilst in use? – guiverc Feb 16 '19 at 03:11
  • @guiverc That's what the picture is from, but that doesn't explain why it doesn't work on the live USB. I'll grab a screenshot of the error from there and post it here. – Sarah Szabo Feb 16 '19 at 04:19
  • The 'live' image uses a '/' created on boot in memory. It's a fixed size that cannot be changed during the session, and I'm better the 'btrfs' resize requires more memory than the live / (fs) has. You may need to resize using an installed system (with the partition unmounted of course). – guiverc Feb 16 '19 at 04:20
  • s/better/betting/ (in my last comment) – guiverc Feb 16 '19 at 04:28
  • @guiverc When you say unmounted, do you mean unmount /dev/sda2? Is that even possible when xServer is running? Or would I have to drop to console before X boots and use the btrfs filesystem resize command from there? Is there any way to use gparted there? – Sarah Szabo Feb 16 '19 at 05:50
  • Yes it's possible to umount a / system, but it's involved & you have to think ahead (ie. fsck, mount & tools you'll soon want to use are no longer accessible) so if you're not aware of how, it's best to avoid (which is why 'live' systems are suggested here). I'm not very familiar with btrfs (yes I use it, but not extensively) so want to avoid advising as fact - why I used the phrase "I'm betting the 'btrfs' resize requires.." (which i stuffed with mistype sorry). I'm expressing opinion only on your btrfs issue here sorry. – guiverc Feb 16 '19 at 06:36
  • @guiverc Updated the question with the new picture and error log. Can you post a solution for how to do the process you're talking about? – Sarah Szabo Feb 16 '19 at 07:09
  • You don't need to resize your partition to copy it somewhere else. You can use btrfs send to copy it to a new disk. – Pilot6 Feb 16 '19 at 07:18
  • @Thomas How do you figure? The selected answer says to install the btrfs-tools package (Which I did on the live usb), update gparted before doing the shrink operation (Which I did), and if that doesn't work, use the GParted live cd (which I did), and it still didn't shrink. Additionally, even the btrfs filesystem resize operation failed from the live usb! – Sarah Szabo Feb 16 '19 at 16:52
  • I'm not a rocket scientist, but it appears that Gparted (btrfs) is attempting to create a very large temporary space in your /tmp directories, which it will use to copy the original file system into, perhaps? Do you have a disk with approx 1/2 TB of space that can be used for this temporary purpose? – Charles Green Feb 16 '19 at 17:02
  • That's why I tried to use the 500GB SSD with a fresh install of Kubuntu on it, but apparently it didn't have enough space remaining. – Sarah Szabo Feb 16 '19 at 17:31
  • Did you by any chance attempt to resize the filesystem as described here prior to resizing the partition? – Elder Geek Feb 17 '19 at 18:08
  • @ElderGeek But the solution to that problem did not resolve my issue. I tried using the gparted live cd and installed the latest version of btrfs-tools. Neither worked. – Sarah Szabo Feb 17 '19 at 18:22
  • Which of the solutions to that problem did you try? There are 2 there along with this warning – Elder Geek Feb 17 '19 at 18:35
  • @ElderGeek I tried both and am not using a RAID array. This is a single disk (Which is backed up). I also tried resize which worked only once subtracting -5g. Now it won't even go -1g which is unexpected given that used is 433GiB and size is 473GiB. – Sarah Szabo Feb 17 '19 at 18:39
  • Since you're in KDE have you tried the Partition Manager? – Kristopher Ives Feb 17 '19 at 18:41
  • @KristopherIves Just tried it, KDE Partition Manager says that it can go down to a minimum size of 408GiB, but fails to shrink it from 476 -> 466GiB. The error message and generated report are basically the same as GParted and are sufficiently vague to not warrant posting. – Sarah Szabo Feb 17 '19 at 18:53
  • Have you considered expanding the partition to fill the unallocated space on the disk to provide some running room, and then resizing the filesystem prior to shrinking the partition? – Elder Geek Feb 18 '19 at 15:54

1 Answers1

0

I found that there were some old Timeshift snapshots. I deleted the snapshots on /dev/sda2 and was able to compress the disk.

It escaped my noticed because I had long since removed and purged timeshift, but the snapshots had remained and bloated due to all the movement on the filesystem.

Sarah Szabo
  • 1,493