Wednesday, August 6, 2008

Success With LVM

After the weekend I came back to a bad hard drive (See error log /var/log/messages). I ran the Dell hard disk tool and got a number 7 code.

I then found a second hard drive and hooked it up to my machine to try to copy as much information over as I could. I booted up with a Live Ubuntu install disk.

I have 3 primary partitions (Dell Utility, /boot, and LVM-8e) with /dev/mapper/main-root /dev/mapper/main-home and /dev/mapper/main-swap as critical LVM partitions.

After booting the live cd, I ran these commands to add LVM support for that session.

  1. sudo aptitude update
  2. sudo aptitude install lvm2
  3. sudo modprobe dm_mod
  4. sudo modprobe dm_mirror
  5. sudo gparted
  6. Copy and paste the 1st (Dell Utiltiy) & 2nd (/boot 100MB) partitions within gparted
  7. sudo cfdisk /dev/sdb
  8. Create a 3rd partition with type 8e - Linux LVM
Now we need to do the LVM magic as followed by the LVM recipes page.
  1. sudo pvcreate /dev/sdb3
  2. sudo vgextend main /dev/sdb3
  3. sudo pvmove /dev/sda3 /dev/sdb3 (Long process)
  4. sudo vgreduce main /dev/sda3
Next we need to copy the MBR (Master Boot Record)
  1. sudo vgchange -a y main (activates the partitions
  2. sudo mount /dev/mapper/main-root /mnt
  3. sudo mount /dev/mapper/main-root /mnt/home
  4. sudo mount /dev/sdb2 /mnt/boot
  5. sudo chroot /mnt
  6. sudo mount -t proc proc /proc
  7. sudo grub-install /dev/sdb
That grub-install command may not have worked or I tried it this way instead.
  1. Exit chroot = exit
  2. sudo grub-install /dev/sdb --root-directory=/mnt/boot
When I booted up, I had a grub error probably because I removed the original drive and had to go to the grub command line and run
  1. grub> root ( //Use grub's tab completion to show all options
  2. grub> root (hda,1) //Basically /dev/sda1
  3. grub> kernel / //Use grub's tab completion to show all current kernels
  4. grub> kernel /vmlinuz-2.6.24-20-generic root=/dev/mapper/main-root
  5. grub> initrd / //Again use grub's tab completion to show all initrd's
  6. grub> initrd /initrd.img-2.6.24-20-generic
  7. grub> boot
  8. Linux should boot correctly and then you need to run a 'sudo update-grub' to correct any grub issues.
This is what I didn't do but would have been much easier
  1. dd if=/dev/sda of=/dev/sdb bs=512 count=1


Aug 4 21:08:28 computername kernel: [378293.902550] res 51/01:60:4c:da:28/00:00:00:00:00/e0 Emask 0x1 (device error)
Aug 4 21:08:28 computername kernel: [378293.925352] ata1.00: configured for UDMA/133
Aug 4 21:08:28 computername kernel: [378293.925358] ata1: EH complete
Aug 4 21:08:28 computername kernel: [378322.629661] res 51/01:60:4c:da:28/00:00:00:00:00/e0 Emask 0x1 (device error)
Aug 4 21:08:28 computername kernel: [378322.653637] ata1.00: configured for UDMA/133
Aug 4 21:08:28 computername kernel: [378322.653643] ata1: EH complete
Aug 4 21:08:28 computername kernel: [378349.828468] res 51/40:60:4c:da:28/00:00:00:00:00/e0 Emask 0x9 (media error)
Aug 4 21:08:28 computername kernel: [378349.850959] ata1.00: configured for UDMA/133
Aug 4 21:08:28 computername kernel: [378349.850964] ata1: EH complete
Aug 4 21:08:28 computername kernel: [378376.559690] res 51/40:60:4c:da:28/00:00:00:00:00/e0 Emask 0x9 (media error)
Aug 4 21:08:28 computername kernel: [378376.584448] ata1.00: configured for UDMA/133
Aug 4 21:08:28 computername kernel: [378376.584454] ata1: EH complete
Aug 4 21:08:28 computername kernel: [378401.822621] res 51/01:60:4c:da:28/00:00:00:00:00/e0 Emask 0x1 (device error)
Aug 4 21:08:28 computername kernel: [378401.847117] ata1.00: configured for UDMA/133
Aug 4 21:08:28 computername kernel: [378401.847121] ata1: EH complete
Aug 4 21:08:28 computername kernel: [378431.825421] res 40/00:60:4c:da:28/00:00:00:00:00/e0 Emask 0x4 (timeout)
Aug 4 21:08:28 computername kernel: [378436.862026] ata1: port is slow to respond, please be patient (Status 0xd0)
Aug 4 21:08:28 computername kernel: [378441.842681] ata1: device not ready (errno=-16), forcing hardreset
Aug 4 21:08:28 computername kernel: [378441.842683] ata1: soft resetting link
Aug 4 21:08:28 computername kernel: [378444.264855] ata1: failed to recover some devices, retrying in 5 secs
Aug 4 21:08:28 computername kernel: [378449.265526] ata1: soft resetting link
Aug 4 21:08:28 computername kernel: [378454.457898] ata1: port is slow to respond, please be patient (Status 0xd0)
Aug 4 21:08:28 computername kernel: [378459.270523] ata1: soft resetting link
Aug 4 21:08:28 computername kernel: [378464.462945] ata1: port is slow to respond, please be patient (Status 0xd0)
Aug 4 21:08:28 computername kernel: [378469.275601] ata1: soft resetting link
Aug 4 21:08:28 computername kernel: [378474.468006] ata1: port is slow to respond, please be patient (Status 0xd0)
Aug 4 21:08:28 computername kernel: [378486.189105] ata1.00: configured for UDMA/133
Aug 4 21:08:28 computername kernel: [378486.189118] sd 0:0:0:0: [sda] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
Aug 4 21:08:28 computername kernel: [378486.189120] sd 0:0:0:0: [sda] Sense Key : Aborted Command [current] [descriptor]
Aug 4 21:08:28 computername kernel: [378486.189123] Descriptor sense data with sense descriptors (in hex):
Aug 4 21:08:28 computername kernel: [378486.189124] 72 0b 00 00 00 00 00 0c 00 0a 80 00 00 00 00 00
Aug 4 21:08:28 computername kernel: [378486.189129] 00 28 da 4c
Aug 4 21:08:28 computername kernel: [378486.189131] sd 0:0:0:0: [sda] Add. Sense: No additional sense information
Aug 4 21:08:28 computername kernel: [378486.189134] end_request: I/O error, dev sda, sector 2677324
Aug 4 21:08:28 computername kernel: [378486.189144] ata1: EH complete
Aug 4 21:08:28 computername kernel: [378509.519389] res 51/40:18:cc:da:28/00:00:00:00:00/e0 Emask 0x9 (media error)
Aug 4 21:08:28 computername kernel: [378509.540917] ata1.00: configured for UDMA/133
Aug 4 21:08:28 computername kernel: [378509.540921] ata1: EH complete
Aug 4 21:08:28 computername kernel: [378510.052261] sd 0:0:0:0: [sda] 156250000 512-byte hardware sectors (80000 MB)
Aug 4 21:08:28 computername kernel: [378510.058538] sd 0:0:0:0: [sda] Write Protect is off
Aug 4 21:08:28 computername kernel: [378510.141910] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Aug 4 21:08:28 computername kernel: [378510.148816] sd 0:0:0:0: [sda] 156250000 512-byte hardware sectors (80000 MB)
Aug 4 21:08:28 computername kernel: [378510.151418] sd 0:0:0:0: [sda] Write Protect is off
Aug 4 21:08:28 computername kernel: [378510.160698] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Aug 4 21:24:17 computername kernel: [379461.168295] res 40/00:18:cc:da:28/00:00:00:00:00/e0 Emask 0x4 (timeout)
Aug 4 21:24:17 computername kernel: [379466.205053] ata1: port is slow to respond, please be patient (Status 0xd0)
Aug 4 21:24:17 computername kernel: [379471.185623] ata1: device not ready (errno=-16), forcing hardreset
Aug 4 21:24:17 computername kernel: [379471.185625] ata1: soft resetting link
Aug 4 21:24:17 computername kernel: [379471.366433] ata1.00: configured for UDMA/133
Aug 4 21:24:17 computername kernel: [379471.366440] ata1: EH complete
Aug 4 21:24:17 computername kernel: [379471.377770] sd 0:0:0:0: [sda] 156250000 512-byte hardware sectors (80000 MB)
Aug 4 21:24:17 computername kernel: [379471.384741] sd 0:0:0:0: [sda] Write Protect is off
Aug 4 21:24:17 computername kernel: [379471.386102] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Aug 4 21:39:07 computername kernel: [380113.535064] res 40/00:18:cc:da:28/00:00:00:00:00/e0 Emask 0x4 (timeout)
Aug 4 21:39:07 computername kernel: [380118.571651] ata1: port is slow to respond, please be patient (Status 0xd0)
Aug 4 21:39:07 computername kernel: [380123.552248] ata1: device not ready (errno=-16), forcing hardreset
Aug 4 21:39:07 computername kernel: [380123.552250] ata1: soft resetting link
Aug 4 21:39:07 computername kernel: [380153.739475] ata1.00: qc timeout (cmd 0xec)
Aug 4 21:39:07 computername kernel: [380153.739480] ata1.00: failed to IDENTIFY (I/O error, err_mask=0x4)
Aug 4 21:39:07 computername kernel: [380153.739484] ata1: failed to recover some devices, retrying in 5 secs
Aug 4 21:39:07 computername kernel: [380163.776678] ata1: port is slow to respond, please be patient (Status 0xd0)
Aug 4 21:39:07 computername kernel: [380166.966361] ata1: soft resetting link
Aug 4 21:39:07 computername kernel: [380167.147111] ata1.00: configured for UDMA/133
Aug 4 21:39:07 computername kernel: [380167.147122] ata1: EH complete
Aug 4 21:39:07 computername kernel: [380197.125557] res 40/00:18:cc:da:28/00:00:00:00:00/e0 Emask 0x4 (timeout)
Aug 4 21:39:07 computername kernel: [380202.162040] ata1: port is slow to respond, please be patient (Status 0xd0)
Aug 4 21:39:07 computername kernel: [380207.142777] ata1: device not ready (errno=-16), forcing hardreset
Aug 4 21:39:07 computername kernel: [380207.142779] ata1: soft resetting link
Aug 4 21:39:07 computername kernel: [380207.323522] ata1.00: configured for UDMA/133
Aug 4 21:39:07 computername kernel: [380207.323527] ata1: EH complete
Aug 4 21:39:07 computername kernel: [380237.301956] res 40/00:18:cc:da:28/00:00:00:00:00/e0 Emask 0x4 (timeout)
Aug 4 21:39:07 computername kernel: [380242.338347] ata1: port is slow to respond, please be patient (Status 0xd0)
Aug 4 21:39:07 computername kernel: [380247.318929] ata1: device not ready (errno=-16), forcing hardreset
Aug 4 21:39:07 computername kernel: [380247.318931] ata1: soft resetting link
Aug 4 21:39:07 computername kernel: [380249.237862] ata1: failed to recover some devices, retrying in 5 secs
Aug 4 21:39:07 computername kernel: [380254.238399] ata1: soft resetting link
Aug 4 21:39:07 computername kernel: [380259.430820] ata1: port is slow to respond, please be patient (Status 0xd0)
Aug 4 21:39:07 computername kernel: [380261.974006] ata1.00: configured for UDMA/133
Aug 4 21:39:07 computername kernel: [380261.974014] ata1: EH complete
Aug 4 21:39:07 computername kernel: [380291.952436] ata1.00: limiting speed to UDMA/100:PIO4
Aug 4 21:39:07 computername kernel: [380291.952443] res 40/00:18:cc:da:28/00:00:00:00:00/e0 Emask 0x4 (timeout)
Aug 4 21:39:07 computername kernel: [380296.988957] ata1: port is slow to respond, please be patient (Status 0xd0)
Aug 4 21:39:07 computername kernel: [380301.969527] ata1: device not ready (errno=-16), forcing hardreset
Aug 4 21:39:07 computername kernel: [380301.969529] ata1: soft resetting link
Aug 4 21:39:07 computername kernel: [380302.150353] ata1.00: configured for UDMA/100
Aug 4 21:39:07 computername kernel: [380302.150358] ata1: EH complete
Aug 4 21:39:07 computername kernel: [380332.128774] res 40/00:18:cc:da:28/00:00:00:00:00/e0 Emask 0x4 (timeout)
Aug 4 21:39:07 computername kernel: [380337.165291] ata1: port is slow to respond, please be patient (Status 0xd0)
Aug 4 21:39:07 computername kernel: [380342.145861] ata1: device not ready (errno=-16), forcing hardreset
Aug 4 21:39:07 computername kernel: [380342.145863] ata1: soft resetting link
Aug 4 21:39:07 computername kernel: [380346.430934] ata1: failed to recover some devices, retrying in 5 secs
Aug 4 21:39:07 computername kernel: [380351.431469] ata1: soft resetting link
Aug 4 21:39:07 computername kernel: [380355.809378] ata1.00: configured for UDMA/100
Aug 4 21:39:07 computername kernel: [380355.809386] ata1: EH complete
Aug 4 21:39:07 computername kernel: [380358.378372] sd 0:0:0:0: [sda] 156250000 512-byte hardware sectors (80000 MB)
Aug 4 21:39:07 computername kernel: [380358.378390] sd 0:0:0:0: [sda] Write Protect is off
Aug 4 21:39:07 computername kernel: [380358.378403] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Aug 4 21:39:07 computername kernel: [380358.378421] sd 0:0:0:0: [sda] 156250000 512-byte hardware sectors (80000 MB)
Aug 4 21:39:07 computername kernel: [380358.388355] sd 0:0:0:0: [sda] Write Protect is off
Aug 4 21:39:07 computername kernel: [380358.388547] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

1 comment:

  1. Many of folks blog about this issue but you wrote down some true words.

    ReplyDelete