[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Building a disk
Re: Building a disk
Tue, 10 Apr 2012 21:28:23 -0700
On Apr 10, 2012 1:00 PM, "Dale Amon" <address@hidden> wrote:
> I've a straightforward problem that recurs time after
> time after time, and I am quite surprised that I have
> not been able to find explicit instructions on how to
> do it. I've tried again and again, occasionally
> successfully with much magic, but not terribly
> Lets say you have a laptop with the system on /dev/sda.
> You mount a hard drive via:
> * A SATA/IDE/USB converter
> * VIA a superbay on a Thinkpad
> * Via a /dev/loop0 of a blank image file
> Now you build a system onto the disk:
> $ dd if=/dev/zero of=/my.host.net.raw count=20M
> $ losetup /dev/loop0 my.host.net.raw
> $ cfdisk /dev/loop0
> # create a 9G bootable linux partition and a 1G swap
> $ kpartx -a -v /dev/loop0
> $ mkfs.ext4 /dev/mapper/loop0p1 -m 0.01 -L "RecoverTest"
> $ mkdir tmp
> $ mount /dev/mapper/loop0p1 tmp
> From the backup server:
> $ rsync -av address@hidden:/srv/backup/ tmp/
> Everything is really easy and straightforward so far, right?
> Now... how do I install grub?
Make sure you're using grub 2.0 beta3 or newer then run:
grub-install --boot-directory=tmp/boot/ /dev/loop0
>The boot device I am building is
> mounted as /dev/sdb or /dev/loop0. When it is actually used it
> will be mounted as /dev/sda. How do I reliably tell that to
Grub2 never depends on how a device used to be enumerated, so this is
not a problem. It should Just Work™.
> This has got to be easy. I just can't believe there isn't a
> simple way to do this.
> Oh, and I might add that I sometimes have to do this for
> grub 1 and sometimes for grub 2. So I need to understand
> both environments.
Grub legacy is not supported here (it hasn't had an upstream for over
six years). If you want support for grub legacy you might try asking
in the support channels for the distribution who you are getting grub
Jordan Uggla (Jordan_U on irc.freenode.net)
- Building a disk, Dale Amon, 2012/04/10
- Re: Building a disk,
Jordan Uggla <=