Friday, September 20, 2013

clone root partition via rsync (to handle 512 vs 4k sector size)

my root partition is failing, giving random io errors during boot. it's a 5 year old 180G hdd using 512 byte sectors. the modern replacement is a 1TB hdd with 4096 byte sectors. so a straight up dd isn't an option. need to do a file by file copy instead mount /dev/sdc1 /mnt # -x limits rsync to a single partition rsync -avxHSAX / /mnt/ for ii in /dev /dev/pts /proc /sys /run; do sudo mount -B $ii /mnt$ii; done sudo chroot /mnt grub-install --recheck /dev/sdc update-grub # label the partition for use in fstab e2label /dev/sdc1 mylabel blkid -c /dev/null gedit /mnt/etc/fstab the error messages are somewhat cryptic. from syslog: ata2.00: exception Emask 0x0 SAct 0x4 SErr 0x0 action 0x0 ata2.00: irq_stat 0x40000008 ata2.00: failed command: READ FPDMA QUEUED ata2.00: cmd 60/08:10:d7:00:19/00:00:0b:00:00/40 tag 2 ncq 4096 in res 51/40:08:d7:00:19/00:00:0b:00:00/40 Emask 0x409 (media error) ata2.00: status: { DRDY ERR } ata2.00: error: { UNC } ata2.00: configured for UDMA/133 sd 1:0:0:0: [sda] Unhandled sense code sd 1:0:0:0: [sda] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE sd 1:0:0:0: [sda] Sense Key : Medium Error [current] [descriptor] Descriptor sense data with sense descriptors (in hex): 72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00 0b 19 00 d7 sd 1:0:0:0: [sda] Add. Sense: Unrecovered read error - auto reallocate failed sd 1:0:0:0: [sda] CDB: Read(10): 28 00 0b 19 00 d7 00 00 08 00 end_request: I/O error, dev sda, sector 186187991 ata2: EH complete and fsck shows some errors, eg "Attempt to read block from filesystem resulted in short read" and some unattached inodes
using rsync to clone
installing grub via chroot

No comments: