I had a dual boot (Windows/Linux) laptop with a 500GB SSD, and replaced the SSD with a 1TB SSD using the procedure described below. When I reboot, it boots directly into Windows, without grub menu. Why did this happen, and how can I restore the grub menu?
This is what I did:
- Boot the laptop from a live bootstick (running Linux Mint)
- Use dd to copy the whole 500GB SSD to a network drive
- Shut down the laptop and replace the SSD by a 1GB SSD.
- Boot again with a live bootstick and use dd to copy the file on the network drive back to the SSD.
- Reboot without live bootstick
I know that this leaves half of my new SSD unused; I was hoping to fix that later.
dd worked correctly, or at least I can mount all partitions including live partitions from a bootstick. This is the output of fdisk -l
:
Disk /dev/loop0: 1.8 GiB, 1912557568 bytes, 3735464 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
GPT PMBR size mismatch (1000215215 != 1953525167) will be corrected by write.
The backup GPT table is not on the end of the device. This problem will be corrected by write.
Disk /dev/nvme0n1: 931.53 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: KINGSTON SKC2500M81000G
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: 282E2059-1738-4156-802F-50E4A4E71652
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1026047 1024000 500M EFI System
/dev/nvme0n1p2 1026048 1288191 262144 128M Microsoft reserved
/dev/nvme0n1p3 1288192 205020339 203732148 97.2G Microsoft basic data
/dev/nvme0n1p4 205021184 206086143 1064960 520M Windows recovery environment
/dev/nvme0n1p5 206088192 214087679 7999488 3.8G Linux swap
/dev/nvme0n1p6 214087680 969730047 755642368 360.3G Linux filesystem
/dev/nvme0n1p7 969730048 970651647 921600 450M Microsoft basic data
/dev/nvme0n1p8 970651648 997961727 27310080 13G Windows recovery environment
/dev/nvme0n1p9 997961728 1000204287 2242560 1.1G Windows recovery environment
Disk /dev/mapper/vg-root: 60 GiB, 64424509440 bytes, 125829120 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/vg-home: 300.32 GiB, 322462285824 bytes, 629809152 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/sda: 14.93 GiB, 16008609792 bytes, 31266816 sectors
Disk model: Cruzer Blade
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: 0x5b137364
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 0 3974271 3974272 1.9G 0 Empty
/dev/sda2 632 8567 7936 3.9M ef EFI (FAT-12/16/32)
/dev/sda3 3977216 31266815 27289600 13G 83 Linux
I have tried to reinstall grub using the following commands (from the live bootstick). These commands helped to restore grub after an earlier Windows update, and they ran without errors, but did not restore grub this time.
mount /dev/mapper/vg-root /mnt
mkdir /efi
mount /dev/nvme0n1p1 /efi
grub-install --directory=/mnt/usr/lib/grub/x86_64-efi --boot-directory=/mnt/boot --efi-directory=/efi
Could the problem be caused by a different UUID for the new disk? I may be wrong, but AFAIK, disk UUIDs are stored on the disk itself so should have been cloned together with the rest of the data. So, what could be wrong and how can I reactivate grub?
Here are some hardware details:
Laptop: Dell XPS 15 (9550)
Old SSD: PM951 NVMe SAMSUNG 512GB
New SSD: Kingston Technology KC2500 M.2 1000 GB PCI Express 3.0 3D TLC NVMe
Pastebin link: http://paste.ubuntu.com/p/DkMGvNXdYq/