Moved partitions, system now unbootable

I recently came to fedora from manjaro, by shrinking my manjaro partitions and installing fedora in the leftover space at the end of my disk.

Some details about my system:
Fedora 35 Plasma, with kernel 5.14.300
/boot is ext4
/ is btrfs, and so is home
Deduplication of btrfs partition has been done using duperemove.

Feeling comfortable in fedora, i wanted to erase manjaro partitions and let fedora fill the whole disk.
To achieve this, i booted into a fedora 34 live usb and used kparted to do four things:

  1. Delete manjaro btrfs root partition
  2. Move fedora /boot partition to the beginning of where manjaro partition used to be
  3. Move beginning of fedora / partition to align with end of fedora /boot partition
  4. Grow fedora / partition to fill remaining disk space

However, operations 2, 3 and 4 failed at the fsck part of the operation. Now, filesystem type of /boot and / are reported as unknown in kparted, and booting from disk leads to grub rescue prompt.

I want to boot off /dev/nvme01. Output of fdisk -l
[liveuser@localhost-live ~]$ sudo fdisk -l
Disk /dev/sda: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: ST2000LX001-1RG1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/nvme0n1: 232.89 GiB, 250059350016 bytes, 488397168 sectors
Disk model: Samsung SSD 960 EVO 250GB               
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: A53DF6D8-3680-B74A-86EE-79FBB912A0BE

Device           Start       End   Sectors   Size Type
/dev/nvme0n1p1    4096    618495    614400   300M EFI System
/dev/nvme0n1p3 2715648   4812799   2097152     1G Linux filesystem
/dev/nvme0n1p4 4814848 217675775 212860928 101.5G Linux filesystem


Disk /dev/sdb: 28.65 GiB, 30765219840 bytes, 60088320 sectors
Disk model:  SanDisk 3.2Gen1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 614D6A77-7A41-475C-94E1-FD0D6C5A65AA

Device     Start      End  Sectors  Size Type
/dev/sdb1   2048 60088286 60086239 28.7G Microsoft basic data


Disk /dev/loop0: 1.88 GiB, 2016305152 bytes, 3938096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 6.84 GiB, 7342129152 bytes, 14340096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 32 GiB, 34359738368 bytes, 67108864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/live-rw: 6.84 GiB, 7342129152 bytes, 14340096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/live-base: 6.84 GiB, 7342129152 bytes, 14340096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/zram0: 8 GiB, 8589934592 bytes, 2097152 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdc: 28.65 GiB, 30765219840 bytes, 60088320 sectors
Disk model:  SanDisk 3.2Gen1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xaaae1f3c

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sdc1  *        2048 60022783 60020736 28.6G  7 HPFS/NTFS/exFAT
/dev/sdc2       60022784 60088319    65536   32M ef EFI (FAT-12/16/32)

output of lsblk

[liveuser@localhost-live ~]$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0         7:0    0   1.9G  1 loop 
loop1         7:1    0   6.8G  1 loop 
├─live-rw   253:0    0   6.8G  0 dm   /
└─live-base 253:1    0   6.8G  1 dm   
loop2         7:2    0    32G  0 loop 
└─live-rw   253:0    0   6.8G  0 dm   /
sda           8:0    0   1.8T  0 disk 
sdb           8:16   1  28.7G  0 disk 
└─sdb1        8:17   1  28.7G  0 part /run/initramfs/live
sdc           8:32   1  28.7G  0 disk 
├─sdc1        8:33   1  28.6G  0 part 
└─sdc2        8:34   1    32M  0 part 
zram0       252:0    0     8G  0 disk [SWAP]
nvme0n1     259:0    0 232.9G  0 disk 
├─nvme0n1p1 259:1    0   300M  0 part 
├─nvme0n1p3 259:2    0     1G  0 part 
└─nvme0n1p4 259:3    0 101.5G  0 part

I installed testdisk and attempted to rescue the partitions, but the tool does not appear to have a solution. The documentation does not list btrfs among the supported filesystems.

TestDisk 7.1, Data Recovery Utility, July 2019
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org

Disk /dev/nvme0n1 - 250 GB / 232 GiB - CHS 238475 64 32

The harddisk (250 GB / 232 GiB) seems too small! (< 252 GB / 235 GiB)
Check the harddisk size: HD jumper settings, BIOS detection...

The following partitions can't be recovered:
     Partition               Start        End    Size in sectors
   Linux filesys. data      5878022  493651589  487773568
>  Linux filesys. data      5878024  493651591  487773568



[ Continue ]
ext4 blocksize=4096 Large_file Sparse_SB Backup_SB, 249 GB / 232 GiB

If I am reading this correctly, all partitions are listed as larger than maximum size. Either that, or the super block is located after the end of the partition.

TestDisk 7.1, Data Recovery Utility, July 2019
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org

Disk /dev/nvme0n1 - 250 GB / 232 GiB - CHS 238475 64 32
     Partition               Start        End    Size in sectors
 P Linux filesys. data     47379070   49476221    2097152
 P MS Data                 50582428   50590619       8192 [MISO_EFI]
 P MS Data                 78403340   78411531       8192 [MISO_EFI]
 P MS Data                 82726308   82734499       8192 [MISO_EFI]
 P MS Data                 85106956   85115147       8192 [MISO_EFI]
 P MS Data                 88886796   88894987       8192 [MISO_EFI]
 P Linux filesys. data     99347152  181134031   81786880 [fedora_localhost-
 P Linux filesys. data    205451134  208846093    3394960 [/]
 P Linux filesys. data    210803784  214198743    3394960 [/]
 P Linux filesys. data    221318160  221951743     633584 [vendor]
 P Linux filesys. data    273438720  275535871    2097152
>P Linux filesys. data    275535872  488396799  212860928 [fedora_localhost-
Structure: Ok.  Use Up/Down Arrow keys to select partition.
Use Left/Right Arrow keys to CHANGE partition characteristics:
                P=Primary  D=Deleted
Keys A: add partition, L: load backup, T: change type, 
     Enter: to continue
btrfs blocksize=4096 Backup superblock, 108 GB / 101 GiB

Trying to read files gives this error

TestDisk 7.1, Data Recovery Utility, July 2019
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org
   P MS Data                     2048    1050623    1048576 [NO_LABEL]
Directory /

No file found, filesystem may be damaged.



Use Right to change directory, h to hide deleted files
    q to quit, : to select the current file, a to select all files
    C to copy the selected files, c to copy the current file

Attempting to Load Backup of fedora-localhost btrfs partition gives this output

TestDisk 7.1, Data Recovery Utility, July 2019
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org

Disk /dev/nvme0n1 - 250 GB / 232 GiB - CHS 238475 64 32
No backup found!


>[ Cancel ]
                  Don't use backup and try to locate partition

btrfs check of root filesystem gives error

[liveuser@localhost-live ~]$ sudo btrfs check -b /dev/nvme0n1
Opening filesystem to check...
No valid Btrfs found on /dev/nvme0n1
ERROR: cannot open file system
[liveuser@localhost-live ~]$ sudo btrfs check -b /dev/nvme0n1p4
Opening filesystem to check...
No valid Btrfs found on /dev/nvme0n1p4
ERROR: cannot open file system

Tried to manually boot into the manjaro /efi partition using grub command prompt, but it seems to have no effect.

set root=(hd2,gpt1)
set prefix=(hd2,gpt1)/grub
insmod normal
normal

Btrfs has its own tools, which are quite complex.
You can try to Check the btrfs integrity, like this:
btrfs check [options] <device>

To get the options, type
btrfs check --help

So this should be done on unmounted file systems, so using your live cd will help.

Do you see something typing
btrfs filesystem show

If you need your device paths, enter
lsblk -fs
and then you may want to use the Label, like
findfs LABEL=fedora_root

1 Like

I did btrfs check, and it returned ‘no btrfs filesystem’ or some similar error.

I didn’t have time to troubleshoot further, so I started over with a fresh install of Fedora 35 KDE using my whole disk.

This is most likely unrelated, but the new install booted once, so I did dnf upgrade and installed and configured snapper, and at the next boot it entered emergency mode.

Cannot open access to console, root account locked

Chrooted into the system and saw no user directories in the /home directory. This may have been caused by bind mounts I made in /etc/fstab, linking directories on a secondary storage drive to user directories in ~/.
I commented those out, created a new user and home directory with adduser and mkhomedir_helper, and created a password for root account.

Reboot and all is well. I can even access my original user and their files, so the extra user account ay have been unnecessary.