0

I need to move a Pop-OS installation from a 250GB HDD to a 128GB SSD. So far I have been trying to use GParted (which worked for moving my Ubuntu installation between drives of the same size).

The recovery and boot partitions copied properly, but to copy the main (root) partition I need to shrink it first (there is enough space). Using GParted to try and shrink it seems to do something for a while, but then errors at the same point (judging by the progress bar) each time. (The title is not related to this problem to try and avoid A/B problem).

I have tried running the e2fsck command written in the GParted details file, and rebooting the machine. None of these have made the shrink work. Without the partition shrink, I don't know how I can move the installation to the smaller drive.

Below is the gparted_details.htm contents generated by the error.

Any and all ideas on how I can move the OS are appreciated.


GParted 1.3.1

configuration --enable-libparted-dmraid --enable-online-resize

libparted 3.4

========================================
Device: /dev/nvme0n1
Model:  CT1000P5PSSD8
Serial: 
Sector size:    512
Total sectors:  1953525168
 
Heads:  255
Sectors/track:  2
Cylinders:  3830441
 
Partition table:    gpt
 
Partition   Type    Start   End Flags   Partition Name  Filesystem  Label   Mount Point
/dev/nvme0n1p1  Primary 34  32767   msftres Microsoft reserved partition    unknown     
/dev/nvme0n1p2  Primary 32768   819232767   msftdata    Basic data partition    ntfs    New Volume  

========================================
Device: /dev/nvme1n1
Model:  RPFTJ128PDD2EWX
Serial: 
Sector size:    512
Total sectors:  250069680
 
Heads:  255
Sectors/track:  2
Cylinders:  490332
 
Partition table:    gpt
 
Partition   Type    Start   End Flags   Partition Name  Filesystem  Label   Mount Point
/dev/nvme1n1p1  Primary 2048    250068991           ext4        /

========================================
Device: /dev/sda
Model:  ATA CT250MX500SSD1
Serial: 2013E298798B
Sector size:    512
Total sectors:  488397168
 
Heads:  255
Sectors/track:  2
Cylinders:  957641
 
Partition table:    gpt
 
Partition   Type    Start   End Flags   Partition Name  Filesystem  Label   Mount Point
/dev/sda1   Primary 2048    1050623 boot, esp   EFI System Partition    fat32       /boot/efi
/dev/sda2   Primary 1050624 1083391 msftres Microsoft reserved partition    ext4        
/dev/sda3   Primary 1083392 487322748   msftdata    Basic data partition    ntfs        
/dev/sda4   Primary 487323648   488394751   hidden, diag        ntfs        

========================================
Device: /dev/sdb
Model:  ATA ST31000528AS
Serial: 5VP2CLXV
Sector size:    512
Total sectors:  1953525168
 
Heads:  255
Sectors/track:  2
Cylinders:  3830441
 
Partition table:    msdos
 
Partition   Type    Start   End Flags   Partition Name  Filesystem  Label   Mount Point
/dev/sdb1   Primary 63  1953520127  boot        ntfs    ExtDisk 

========================================
Device: /dev/sdc
Model:  ATA ST500DM002-1BD14
Serial: Z2AXE6DG
Sector size:    512
Total sectors:  976773168
 
Heads:  255
Sectors/track:  2
Cylinders:  1915241
 
Partition table:    msdos
 
Partition   Type    Start   End Flags   Partition Name  Filesystem  Label   Mount Point
/dev/sdc1   Primary 2048    976769023           ntfs    stuff   

========================================
Device: /dev/sdd
Model:  ATA WDC WD2500BEVT-7
Serial: WD-WXR1A60R1236
Sector size:    512
Total sectors:  488397168
 
Heads:  255
Sectors/track:  2
Cylinders:  957641
 
Partition table:    gpt
 
Partition   Type    Start   End Flags   Partition Name  Filesystem  Label   Mount Point
/dev/sdd1   Primary 4096    2097150 boot, esp       fat32       
/dev/sdd2   Primary 2097152 10485758    msftdata    recovery    fat32       
/dev/sdd3   Primary 10485760    480004462           ext4        
/dev/sdd4   Primary 480004464   488393070   swap        linux-swap      

========================================
Device: /dev/sde
Model:  USB DISK
Serial: 
Sector size:    512
Total sectors:  15730688
 
Heads:  255
Sectors/track:  2
Cylinders:  30844
 
Partition table:    msdos
 
Partition   Type    Start   End Flags   Partition Name  Filesystem  Label   Mount Point
/dev/sde1   Primary 8192    15728639            ntfs    NTFS    /media/yee/NTFS
/dev/sde2   Primary 15728640    15730687    lba     fat16   UEFI_NTFS   /media/yee/UEFI_NTFS

========================================
Shrink /dev/sdd3 from 223.88 GiB to 107.42 GiB  00:11:10    ( ERROR )
        
calibrate /dev/sdd3  00:00:02    ( SUCCESS )
        
path: /dev/sdd3 (partition)
start: 10485760
end: 480004462
size: 469518703 (223.88 GiB)
check filesystem on /dev/sdd3 for errors and (if possible) fix them  00:00:15    ( SUCCESS )
        
e2fsck -f -y -v -C 0 '/dev/sdd3'  00:00:15    ( SUCCESS )
        
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

527061 inodes used (3.59%, out of 14680064)
962 non-contiguous files (0.2%)
411 non-contiguous directories (0.1%)
# of inodes with ind/dind/tind blocks: 0/0/0
Extent depth histogram: 502974/140
24348903 blocks used (41.49%, out of 58689837)
0 bad blocks
15 large files

454992 regular files
45072 directories
15 character device files
1 block device file
7 fifos
4994 links
26959 symbolic links (23910 fast symbolic links)
6 sockets
------------
532046 files
e2fsck 1.46.5 (30-Dec-2021)
shrink filesystem  00:10:53    ( ERROR )
        
resize2fs -p '/dev/sdd3' 112640000K  00:10:53    ( ERROR )
        
Resizing the filesystem on /dev/sdd3 to 28160000 (4k) blocks.
Begin pass 2 (max = 10272100)
Relocating blocks XXXXXXXX--------------------------------
resize2fs 1.46.5 (30-Dec-2021)
resize2fs: Attempt to read block from filesystem resulted in short read while trying to resize /dev/sdd3
Please run 'e2fsck -fy /dev/sdd3' to fix the filesystem
after the aborted resize operation.

1 Answer 1

1

Solution is simple:

Don't shrink the partition and copy it.

Instead, make a new partition on the target SSD, and copy over the files from the old partion. There's no reason why you couldn't do that – and it's both easier and safer.

4
  • Somehow, in my idea fixation, I missed this obvious solution. Thanks for the tip. (The files are copying over right now.) Presumably I will have to edit the /etc/fstab to make the UUID correct again?
    – Liftyee
    May 14, 2023 at 19:16
  • Watch that you preserve all file properties while copying! Updating /etc/fstab is a good idea :) and when you've done all that, follow askubuntu.com/a/3409 to force grub to update the partitions (you might want to do that with the SSD built in to the target machine from a live medium, if that's not what you're currently doing) May 14, 2023 at 19:23
  • I usually suggest a new install & restore from backups. If keeping both drives connected you cannot have duplicate UUIDs & GUIDS when you reboot, or you have major issues. And with gpt(GUID) you cannot easily copy a partition. It has GUID in primary partition table, backup partition table at end of drive & in partition. Those all have to be in sync. Some tools may allow edit of GUIDs, but really easier just to do an install.
    – oldfred
    May 15, 2023 at 3:01
  • @oldfred That's what I ended up having to do, because I mistakenly assumed that Pop-OS used GRUB (like default Ubuntu installs) and installed it, fubar'ing the installation. Maybe the GUIDs were also wrong which made it not boot before I tried GRUB. Good advice. (including - always have backups! which I don't...)
    – Liftyee
    Jun 5, 2023 at 20:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .