[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: replacing boot and only disk drive



On Sat, 22 Nov 2014 18:38:41 -1000, Joel Roth wrote:

> On Sat, Nov 22, 2014 at 11:29:20PM +0000, Hendrik Boom wrote:
>> I have a laptop (an old Asus EEEPC), and I need to replace its only
>> disk drive with a larger one.  The hardware aspects are easy -- keep
>> static electricity away and use a screwdriver.  I have the new drive on
>> my desk already.
>> 
>> And it's not hard to copy the file systems, either.  I can temporarily
>> access the new drive using a USB adaptor.  fdisk and the lvm utilities
>> will create the new partitions and then I copy, using dd or rsync  or
>> tar/ untar or even cp --archive.  Perhaps a recursive checksum script
>> afterward just in case.
>> 
>> It's currently a dual boot between Debian Jessie and Windows XP.  I can
>> copy the Windows partition using ntfs-3g.  Or maybe dd if that fails.
>> Windows XP comes with the usual C: drive (/dev/sda1), a hidden Windows
>> partition (/dev/sda3), and en EFI paritition (/dev/sda4).  All of Linux
>> hides out in the so-called extended partition (/dev/sda2).  I have no
>> idea what Windows does with the space at the start of the drive before
>> he first partition.  Presumably grub messes with this space, too.
>> 
>> But I'm concerned about installing the bootloader.  I presumably have
>> to do this before I actually swap drives, or the machine won't boot.
>> 
>> Currently I'm using grub-legacy to boot.

Actually, grub2.

>> Presumably I'll want the
>> configuration file in the new system to be pretty well the same as the
>> old, but there may have to be changes.  And when I'm installing the
>> boot loader it's got to set everything up to refer to the new disk
>> drive even though when that gets used it will be in a different
>> electronic location on  the machine.  (it'll be /dev/sda instead of
>> /dev/sdb)
> 
> If you use UUIDs instead of /dev/sd??, you avoid the issue of locations
> changing.
> 
> If the new /dev/sda drive has GRUB in the MBR, I  believe you should be
> able to boot from the command line in any case.
>  
> Grub can boot Windows just fine.
> 
> regards,
> 
> Joel

So I create partitions, copy all the files, edit my grub--config to add 
stanzas just like the existing ones but with the new UUIDs (possibly 
changing menu entries by adding 'old' or 'new'), copy *it* to to the new 
drive too, and then
  grub-install /dev/sdb
or whatever the new drive happens to be at the moment.

If necessary (thought from what you say it probably won't be), repeat 
this after the new drive has been properly installed in the machine so it 
can still find Windows.

And there shouldn't be any show-stopping gotchas.  Just minor ones from 
miscopying UUIDs and the like.  Normal debugging.

-- hendrik


Reply to: