You are not logged in.

#1 2024-01-23 08:47:13

dviktor
Member
From: Moscow
Registered: 2015-10-18
Posts: 162

fix MBR/partition table without reinstalling bootloader

I'm forced to clone old HDD inside rare equipment to the new drive because of imminent failure of old one (load cycle count exceeded mean failure rate threshold).
we've bought new SSD (larger than old drive) to make cloning.

I was able to successfully mirror MBR and system partition to the new disk with the following:

# MBR first
dd if=/dev/sdb of=/dev/sdc bs=512 count=1

# system then
dd if=/dev/sdb1 of=/dev/sdc1 bs=1M conv=noerror,sync status=progress

after that I've enlarged new partition on new drive to make use of free space (new SSD is larger than old drive):

parted /dev/sdc
# resizepart 1 100%

e2fsck -f /dev/sdc1
resize2fs /dev/sdc1

that worked properly and I was even able to boot from new drive successfully. However, I've realized that old drive has 512/512 logical/physical sector size while new SSD has 512/4096 (Advanced Format) sector sizes. because of that partition on a new SSD is not properly aligned to the physical sector size. AFAIK most common partition tools (parted, gparted, fdisk etc) are not able to move partition without breaking system boot because they're not fixing MBR properly (gparted warns about it explicitly). I have no chance to reinstall bootloader on that hard drive so I wonder if there is a way/tool to realign partition on a new SSD and fix MBR properly to save boot.

Last edited by dviktor (2024-01-23 08:48:31)

Offline

#2 2024-01-23 09:32:26

-thc
Member
Registered: 2017-03-15
Posts: 476

Re: fix MBR/partition table without reinstalling bootloader

Can you show us the sector numbers?

fdisk -l /dev/sdX

Offline

Board footer

Powered by FluxBB