Problem Overview
I recently upgraded my remote server contract with IONOS, increasing my hard drive space from 8GB to 80GB. I have an Ubuntu OS running bash.
I then went about extending my working partition, following a tutorial here: https://www.ryadel.com/en/resize-extend-disk-partition-unallocated-disk-space-linux-centos-rhel-ubuntu-debian/
All was OK, I wrote a new partition map, then rebooted my system. I waited a minute or two and then attempted to ssh into my server as usual. Problem. My ssh connection hangs, until eventually exiting with a time out.
Solution Attempts
At first, I reasoned the process of rebooting after a partition map change may take some time, and this was the cause of the timeout. After several more ssh attempts, this did not seem likely.
I used a 'KVM Console' provided in my IONOS console - here, the shell is in a state of (initramfs).
In attempting to diagnose the issue, I have tried the following:
- Running:
fsck /dev/sda1Result:/dev/sda1: clean, 312/124672 files, 26890/124672 blocks - Running:
fsck /dev/sda1Result:fsck: error 2 (No such file or directory) while executing fsck.ext2 for /dev/sda2 - Running:
blkidResult:
/dev/sda1: UUID="longString" TYPE="ext4" PARTUUID="520f1760-01"
/dev/sda2: PARTUUID="520f1760-02"
- Running all of the following commands returns
sh: command name: not found. These are:
- vgdisplay -v vg00
- parted -l /dev/sda
- free -m
- cfdisk
- lvdisplay -v
- fdisk /dev/sda
- pvresize /dev/sda2
- The output of
cat proc/partitionsis:
major minor #blocks name
8 0 83886080 sda
8 1 498688 sda1
8 2 83386368 sda2
11 0 1048575 sr0
From the above, I am confused why (2) returns no such file or directory - the entry sda2 is listed under the directory dev.
- The output of
cat /proc/cmdlineis:BOOT_IMAGE=/vmlinuz-5.4.0-132-generic root=/dev/mapper/vg00-lv01 ro apparmor=0 - After entering
lvmand thenvgscan -ccc, the output is:
....
Start of output not visible in terminal window due to no scrolling
....
filter caching bad /dev/loop5
Opened /dev/loop6 RO O_DIRECT
/dev/loop6: size is 0 sectors
Closed /dev/loop6
/dev/loop6: Skipping: Too small to hold a PV
filter caching bad /dev/loop6
Opended /dev/loop7 RO O_DIRECT
/dev/loop7: size is 0 sectors
Closed /dev/loop7
/dev/loop7: Skipping: Too small to hold a PV
filter caching bad /dev/loop7
Will scan 3 devices skip 0
Checking fd limit for num_devs 3 want 35 soft 1024 hard 4096
Scanning 3 devices for VG info
Scanning submitted 3 reads
Processing data from device /dev/sda 8:0 fd 4 block 0x55b511a17cd0
Scan filtering /dev/sda
/dev/sda: using cached size 167772160 sectors
/dev/sda: Skipping: Partition table signature found
filter caching bad /dev/sda
/dev/sda: Not processing filtered
Processing data from device /dev/sda1 8:1 fd 5 block 0x55b511a17d10
Scan filtering /dev/sda1
/dev/sda1: using cached size 997376 sectors
/dev/sda1: Device is a partition, using primary device sda for mpath component detection
/dev/sda1: using cached size 997376 sectors
filter caching good /dev/sda1
/dev/sda1: No lvm label detected
Processing data from device /dev/sda2 8:2 fd 6 block 0x55b511a17d50
Scan filtering /dev/sda2
/dev/sda2: using cached size 166772736 sectors
/dev/sda2: Device is a partition, using primary device sda for mpath component detection
/dev/sda2: using cached size 166772736 sectors
filter caching good /dev/sda2
Label checksum incorrect on /dev/sda2 - ignoring
/dev/sda2: No lvm label detected
Scanned devices: read errors 0 process errors 0 failed 0
Found VG info for 0 VGs
Obtaining the complete list of VGs to process
No volume groups found
Unlocking /run/lock/lvm/P_global
_undo_flock /run/lock/lvm/P_global
Dropping VG info
lvmcache has no info for vgname "#orphans_lvm2" with VGID #orphans_lvm2.
lvmcache has no info for vgname "#orphans_lvm2".
lvmcache: Initialised VG #orphans_lvm2.
Completed: vgscan -vvv
- The directory
/etc/lvm/backupexists and contains:vg00The directory/etc/lvm/archiveexists and contains:vg00_00000-1647277590.vg vg00_00001-1228658393.vg
(3) and (5) give me hope - the location seems to be recognised, what would this suggest ?
Specific Steps Before Reboot
In summary, the steps I took before rebooting my system were:
- ran
fdisk /dev/sdaand noted the start and end points of the file systems by enteringp. - Deleted the file system map by entering
dand then selectingsda2with2 - Created a new partition map by entering
n. Setting the partition type toprimary. - I then entered the start and end locations for the new partition, as noted in step (1).
- I changed the partition type, by entering
t, and selecting the 2nd partition by entering2. - I specified the partition type to be 'Linux LVM' by entering the HEX code
8e. - Before writing to the disk, I ensured start and end points were correctly listed by entering
p. The start point matched that of the original partition. The end point matched that of the disk end point. - I wrote the partition map to disk by entering
w. - I reboot the system with
reboot.
The result of running lvm p prior to partition map changes was:
At this point I am not sure how to proceed - I have encountered a file system issue before and was troubled at the prospect of loosing all my files. Ultimately, in that case, the files were still present. From that experience I am restraining my assumption all is lost.
Does anyone have any suggestions, or tips to offer in terms of debugging this situation ? Please feel free to ask if you would like extra information regarding my setup.
Update
I have been able to boot into a knoppix CD on my remote server. Here, I have run fdisk -l which outputs:
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
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/ram1: 4 MiB, 4194304 bytes, 8192 sectors
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/ram2: 4 MiB, 4194304 bytes, 8192 sectors
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/ram3: 4 MiB, 4194304 bytes, 8192 sectors
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/ram4: 4 MiB, 4194304 bytes, 8192 sectors
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/ram5: 4 MiB, 4194304 bytes, 8192 sectors
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/ram6: 4 MiB, 4194304 bytes, 8192 sectors
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/ram7: 4 MiB, 4194304 bytes, 8192 sectors
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/ram8: 4 MiB, 4194304 bytes, 8192 sectors
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/ram9: 4 MiB, 4194304 bytes, 8192 sectors
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/ram10: 4 MiB, 4194304 bytes, 8192 sectors
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/ram11: 4 MiB, 4194304 bytes, 8192 sectors
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/ram12: 4 MiB, 4194304 bytes, 8192 sectors
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/ram13: 4 MiB, 4194304 bytes, 8192 sectors
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/ram14: 4 MiB, 4194304 bytes, 8192 sectors
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/ram15: 4 MiB, 4194304 bytes, 8192 sectors
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/cloop0: 1.83 GiB, 1960312832 bytes, 3828736 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/cloop1: 9.63 GiB, 10335027200 bytes, 20185600 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: 1.45 GiB, 1560817664 bytes, 381059 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/sda: 80 GiB, 85899345920 bytes, 167772160 sectors
Disk model: Virtual disk
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: 0x520f1760
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 999423 997376 487M 83 Linux
/dev/sda2 999424 167772159 166772736 79.5G 8e Linux LVM
I feel the final output lines, displaying the partition map for sda1 and sda2, are of interest. I believe the type of sda2 is correct as 8e (a Linux LVM), and the Start value correctly falls after the End of sda1.
Update II
Before attempting the below steps, I created a snapshot for backing up the system to its current state. I have now returned to this snapshot.
Attempting to restore from the /etc/lvm/backup/vg00 file (initramfs), first I ran pvcreate --restorefile /etc/lvm/backup/vg00 --uuid R5VWXg-jamB-5dWM-PpwY-7a49-LRz7-Vrvdl2 /dev/sda2. This returned:
WARNING: Couldn't find device with uuid `R5VWXg-jamB-5dWM-PpwY-7a49-LRz7-Vrvdl2.
Failed to clear hint file.
Physical volume "/dev/sda2" successfully created.
Then, I ran vgcfgrestore --file /etc/lvm/backup/vg00 which returned:
No command with matching syntax recognised.
Nearest similar syntax command has syntax:
vgfcgrestore -f:--file String VG
Restore VG metadata from specified file.
There seems to be an issue here.

cat /proc/partitions?lvm vgs? boot a rescue system and check / chroot from there?cat /proc/partitionsto my question. Enteringlvm vgsreturns nothing. Booting into recovery mode printsBegin: Running /scripts/local-top ... Volume group "vg00" not found Cannot process volume group vg00followed by ` Gave up waiting for suspend/resume device. I am then returned to the(initramfs)` shell - do you suggest I can chroot from here ?hexdump -C /dev/sda2 | lessand see if you find LVM metadata (ascii). but it's tiresome to do this with initramfs shell, so a proper rescue system would be goodlvm vgscan, thenlvm pvs. It should showsda2as a LVM physical volume - if not, you could readdmesg | lessto see if there are any error messages about partitionsda2. You might also trylvm vgscan -vvv, but be warned: the output will be quite long. If you can capture it and put it into an accessible pastebin somewhere, that would be great.hexdumporless.