manually apply image
-
I have seen some threads about this in the forums and I know that generally the answer is “Clonezilla FTW”, however I am trying to do something more lightweight. I am very close to success but I think I am missing some steps, if anyone sees my mistake I’d love the help and also I know others have wanted to do this as well. So this is what I know so far:
I have a part clone windows image in a folder for ubuntu1804. In it there is a partitions table for sfdisk, a dd copy of the MBR, some EBR files (which appear to be empty?), a swap file uuid, and in my case 2 img files that are partclone images of the 2 partitions. I can see that there are the 2 real images and partitions and then there are the EBR’s and the Swap from the partitions file.
Something like this:
click here for Imgur of my partitions
Ok so I dug into the download, func, and partfunc, shell scripts in FOS. It looks like the following steps need to be done:
- I dd the d1.mbr file to /dev/sda
- I sfdisk the d1.partitions file to /dev/sda
- I loop through the partitions and use partclone.restore on d1p1.img to /dev/sda1
- I dd the d1p1.ebr file to /dev/sda1
- I don’t have an image for d1p2 so I just dd the d1p2.ebr to /dev/sda2
- same with d1p5, no image just the d1p5.ebr that I dd to /dev/sda5
- I hav a d1p6.img so I partclone.restore that to /dev/sda6
- I dd the d1p6.ebr to /dev/sda6
- I get the uuid out of the d1.original.swapuuids
- I use the uuid with mkswap for the -U argument and mkswap to /dev/sda5
If that is correct I should be booting up, but it just sits at a blinking cursor. I know that I could grow partitions or swap uuids, but I’ll work on that after I have a booting setup. I have flipped the order of some of the above and got the MBR to boot to a grub or a initrd, but never to the OS disk.
I am sure I am missing a simple step here. I’ll keep digging into it and post back more results and document which order produces which results. This is very useful though because if I can capture with fog and then just simply script a quick Ramdisk (I have made one with debirf already waiting to script this once I do it manually) that can auto load an OS with no interaction. Obviously this only works well if you have a bunch of the exact same machine, but it is still VERY useful.
Let me know if anyone spots a mistake in my list or the order and check back if you are interested in following my adventures lol.
- list item
-
back in a hurry, so if I put the mbr on after all the above steps by dd’ing it I drop into the initramfs. It looks like I didn’t apply all the uuids correctly. So I would say swap the order of 1 and 2 and get the uuids fixed are my current tasks.
-
Ok so I have some step by step that has gotten me MUCH closer:
- dd the MBR file to /dev/sda
- sfdisk the partitions to /dev/sda
stopping here yields you a rescue grub prompt with nothing to boot to
- partclone restore d1p1.img to /dev/sda1
stopping here yields you an initrd with an error wanting the d1p6 img and uuid
- partclone restore d1p6.img to /dev/sda6
- mkswap to /dev/sda5 with the uuid from the orig uuid file
stopping here has gotten me to a working ubuntu that just needs to reboot out of grub rescue.
I’m going to try to fix that so it doesn’t need that last little bit of help. I’m guessing an update to grub should fix it.
-
@ibivibiv I wonder if you are taking the long way to get to the destination.
FOS Linux has everything you need to deploy a FOG collected image. FOS Linux can boot and will fit on a 512MB usb flash drive.
With the proper kernel parameters you can almost deploy an image without the need of a fog server. You will have to of course modify the FOG scripts in the /bin directory on the FOS Linux initfs. You will need to bypass any curl call and return the expected parameters and also tell the scripts to look at the local media instead of the NFS mount. This may be a bigger task than I’m thinking because I haven’t looked in the code.
-
Yes, and thanks for the reply. I’ve been in there and taking notes. There is quite a bit there and figuring out all the dependencies that FOS needs to run its scripts is a bit tricky. I’m pretty much almost there. FOS is a very nice boot kernel as well and those scripts are handy to reference but there is so much to hack to prevent it from failing on script runs I figured I would just make a clean initrd and a simple script. I’m going to try to run a grub update today and see if it lays down the image clean without the need to boot manually for a rescue on first boot. Technically its working right now it is just the first time the OS boots right now you have to go through the selection to boot into Ubuntu from the rescue menu. After that first time it just works fine.
-
@ibivibiv OK this info is just some background on FOS Linux. It may help you improve your image booting environment.
You can use the FOS initrd image if you want and can boot that from a usb stick.
If you use the fos initrd files you can just unpack them and make changes that fit your need and then repack them. The instructions are here: https://wiki.fogproject.org/wiki/index.php/Modifying_the_Init_Image
When the FOS Linux kernel starts up (well actually finishes booting) within the inits in
/etc/init.d
there is a FOG startup script in S99fog. If you remove that file from the inits (or change it to your script) then it will disable the FOG master script from running.I have a tutorial on creating a fos linux boot image. That information is here: https://forums.fogproject.org/topic/7727/building-usb-booting-fos-image/4
Here are the kernel parameters set to FOS Linux to download an image to a target computer.
#!ipxe set fog-ip 192.168.1.53 set fog-webroot fog set boot-url http://${fog-ip}/${fog-webroot} kernel http://192.168.1.53/fog/service/ipxe/bzImage loglevel=4 initrd=init_.xz root=/dev/ram0 rw ramdisk_size=275000 web=http://192.168.1.53/fog/ consoleblank=0 rootfstype=ext4 mdraid=true mac=00:50:56:b3:51:e7 ftp=192.168.1.53 storage=192.168.1.53:/images/dev/ storageip=192.168.1.53 osid=9 irqpoll hostname=DEVEFI2 chkdsk=0 img=Win101903 imgType=n imgPartitionType=all imgid=43 imgFormat=5 PIGZ_COMP=-11 pct=5 ignorepg=1 type=down imgfetch http://192.168.1.53/fog/service/ipxe/init.xz boot
-
@ibivibiv Ok I was correct! I think maybe there is a more clever way to update the grub directory contents (grub update command etc.) but basically if I do the following I find myself with a fairly close to working system:
- dd the MBR file to /dev/sda
- sfdisk the partitions to /dev/sda
- partclone restore d1p1.img to /dev/sda1
- Take the grub contents from the original machine and overwrite them onto sda1
- partclone restore d1p6.img to /dev/sda6
- mkswap to /dev/sda5 with the uuid from the orig uuid file
This drops me into the grub menu and after the timeout it boots as normal.
Not too bad, and hopefully it helps anybody else that asks this question. I saw it gets brought up sometimes.