Deploying images from USB



  • Hi,

    I’m trying to deploy an image made from a fog server on a usb stick. I have managed to get the computer to boot and list up the “start page” made by the syslinux.cfg (default) file, but when trying to do a quick image the computer shuts down. I used the guide wound on wiki [url]http://www.fogproject.org/wiki/index.php?title=Bootable_Media[/url] but this is very outdated. The files needed are not longer a part of fog so I got the files needed from v0.32. Also the syslinux.cfg are almost a copy of this [url]http://fogproject.org/wiki/index.php/Edit_PXE_menu_to_create_sub_menus[/url]. Just removed the last part.

    Is there any way to do make a bootable usb stick with fog on it to deploy images made on a fog server? The images has to be stored locally on the stick since the computer is not going to have any network connection while deploying an image. I also want to be able to but a few images in a folder on the usb stick and get to choose the image to deploy.

    Another issue around this would be that the images made from the server could have files that are not supported by the fat32 file system because they are too big. Is there any way to split the images files into smaller files with a given maximum size?


  • Developer

    Probably you could also capture one image using clonezilla from that particular kind of client just to have a template of clonezilla files ready. Then swap ‘sdaX.<fstype>-ptcl-img.gz.aa’ files with those you got from fog. From what I could find out they should be in the correct format (partclone packed with gzip) already. You just need to rename them properly. Give it a try…


  • Developer

    to use clonezilla with fog images, you will need to set up the partitions manually, such as by using gparted. then use the command line to write the image to the partition. this is more or less what you’ll need to tell it
    [CODE]gunzip -d -c < $file | partclone.restore --ignore_crc -O $disk -N -f[/CODE]

    [quote=“Jørn Pettersen, post: 42619, member: 28650”]Have also thought about having a virtual box setup locally on a laptop with a fog server to run in these situations.[/quote]
    people have done this as well, and it works



  • I had installed Ubuntu and Fog on a 64GB stick and made it a bootable server for when I go to remote sites. I use a computer to boot the USB stick(makes a temporary server) and the rest get rebooted so that they can get their info from the fog server it works ok but really need a USB3.0 stick 2.0 takes about 3 times longer than normal.


  • Moderator

    [quote=“Jørn Pettersen, post: 42619, member: 28650”]I see your point Wayne. And for 99% of the time we use an image server. But sometimes we need to do an quick imaging of a computer without having a server around and then we need to have a offline method to do the imaging. Have also thought about having a virtual box setup locally on a laptop with a fog server to run in these situations.[/quote]

    But even then, if your production hardware is similar enough (just a few models), you could have ready-to-go hard drives in your bag/work van to install in those broke down systems.

    And you could totally set up FOG on a laptop, and have it dish out DHCP and the works. You would need a cross-over cable in order to not use a switch. It’d work fine.

    But, that’s an inefficient method. I’d personally just have hard drives ready to stick in, myself.



  • I see your point Wayne. And for 99% of the time we use an image server. But sometimes we need to do an quick imaging of a computer without having a server around and then we need to have a offline method to do the imaging. Have also thought about having a virtual box setup locally on a laptop with a fog server to run in these situations.



  • Yes I agree with you Junkhacker after the last response from Uncle Frank it seems like a bigger job than expected. Tried to search a bit around this but did not find anything about a conversion or something of images made in fog and then deployed using clonezilla. Do you know anything about this? I tried to just copy the image from fog to clonezilla, but that did not work. Clonezilla has more files in their image folder that fog has and the naming is different.
    Sorry for all my questions… But I really need a working solution up and running. All the help are very much appreciated!


  • Moderator

    Could always just haul around hard drives with the right images on them already… Way faster than imaging!


  • Developer

    [quote=“Junkhacker, post: 42613, member: 21583”]i really think it would be easier to create a clonezilla usb boot stick, and copy your image to it, instead of trying to rewrite the fog stuff[/quote]
    You could be right there. Somehow I got drawn away by the idea of being able to make FOG do local restore… Maybe it’s just easier to use clonezilla.


  • Developer

    i really think it would be easier to create a clonezilla usb boot stick, and copy your image to it, instead of trying to rewrite the fog stuff


  • Developer

    I just heard about FOG not supporting USB-storage to prevent trouble if someone left a stick in one of the clients by accident (see Junkhackers comment here: [url]http://fogproject.org/forum/threads/request-for-help-or-maybe-just-answers.12476/#post-42596[/url]). So you’d have to build your own kernel. Let me know if you need assistence with that. See some instructions here: [url]http://fogproject.org/wiki/index.php?title=Building_a_Custom_Kernel[/url] or even better here: [url]http://fogproject.org/wiki/index.php/Build_TomElliott_Kernel[/url]

    Within the init.xz file you want to study those files:
    [CODE]/bin/fog.download
    /bin/fog.checkin
    /usr/share/fog/lib/funcs.sh[/CODE]

    FOG mounts /images via NFS from the server. Change this to mount your USB-Stick. But there probably is quite some work to be done in fog.checkin too, I’d say. Forgot about that at first, sorry.

    One more thing I just remembered. You probably will have to change your boot parameters sooner or later too to match things for your scenario. See how you go and let me know if I can help you.



  • Thank you for all helpful tips, it really helps me on the way to accomplish what I need. Uncle Frank, I did what you suggested and ended up with a bootable usb stick and as you said ended up with command line. But it seems like usb controllers are removed from the kernel or the init file. Is this correct? Any suggestions how to add this again?

    I will start to edit the files needed to make fog image the computer for the stick, but is it fog.download I must edit? Could someone please describe a bit what files are involved when I want to image a computer? (If someone has already made a description of how rings work and the files involved please someone tip me. I´m really interested in getting t know the system :) ) I guess the file that involves imaging the computer need a path to where the image is stored, so I will try to implement usb detection and mount that usb stick and make a list if all available images where the user could choose from and then send the path to fog.


  • Developer

    right now a imageFormat flag of “2” can only be set in the database directly, by command line or a tool like phpmyadmin. having the images split is useful for offline backup and file transfers, but not really for storing the data on multiple disks. all of the image files must be in the same location at the start of the imaging process, or it will fail. fog images should be deployable using clonezilla with the right command line syntax, as fog images are just compressed partclone images.


  • Developer

    [quote=“Jørn Pettersen, post: 42539, member: 28650”]As I’ve understand it, when choosing something in the startup menu on a client, you actually tell the server what to do at the next reboot?[/quote]
    No, not usually. There are a couple of tasks (especially if that particular host is not registered yet) that you can run from the PXE menu, like register the host or quick imaging. That “task” is then run straight away. BUT usually all tasks are being scheduled via the webinterface. The clients are then woken up via WOL and run that scheduled task without any further user interaction (no PXE menu but booting straight into FOG an run the task). But this is only important for you if you use FOG in a network scenario as well.

    [quote=“Jørn Pettersen, post: 42539, member: 28650”]Tom, where can I change the image format? If I do so, do I need a newer version of fog to deploy this image again? And last, since you are using partclone to do the imaging, is it possible to deploy this image with another image tool that also use partclone?[/quote]
    I am still new to FOG so I don’t know for sure but AFAIK image format can only be set in the database. So you’d need to install phpmyadmin or similar tools to do this. Tom, please correct me if that’s not true.

    I reckon that you could deploy that image using clonezilla for example. But it would need some kind of shell script too I’d say. Up to you if you want to dive into clonezilla or changing FOG for your needs.


  • Developer

    Take it one step at a time…
    I’d recommend using FOG 1.2.0 for now although it probably would not hurt to use current SVN either. Your choice.

    1. Get an USB Stick with FOG running
    • (Format it with FAT32 and put syslinux onto it - I guess you’ve done that already)
    • copy /var/www/fog/service/ipxe/bzImage(32) and /var/www/fog/service/ipxe/init(_32).xz to USB-Stick
    • Use the following configuration (home brew) and change to bzImage/init.xz for 64bit:
      [CODE]DEFAULT fog
      LABEL fog
      KERNEL /bzImage32
      APPEND initrd=/init_32.xz root=/dev/ram0 rw ramdisk_size=127000 nodhcp loglevel=4 osid=5 chkdsk=0 type=down mode=debug[/CODE]
    • Boot the client using that Stick. If everything works you’ll end up with a lot off messages saying “Sending discovery…”
    1. Modify FOG


  • Thanks for you replies. Yes I’m also more found of imaging from a server because of the speed and the fact that it is more manageable to have all images stored in one location. But we are going to use this is a businesses environment and because of that we need to have a way to deploy an image from a usb stick as well. It’s not always the computer we are deploying an image to is connected to a network. We are in the process or choosing a image tool to use for the future and I’m really starting to like fog a lot because the functionality and the easiness to do configurations from a web interface and in fact that we can get help from this forum and developers if there are any things we struggling with.

    But back to the case. Uncle Frank, could you provide more specific info on how I could make fog work on a usb stick? As of now I’ve tried with a earlier version of fog because of the use of syslinux.cfg file. In the newer versions this is removed and I’m not sure of how to get this to work. But, a image made from a newer version, is it possible to deploy this with a version 0.32 (the version I’ve used)? As I’ve understand it, when choosing something in the startup menu on a client, you actually tell the server what to do at the next reboot? How could I then skip this reboot and go right from choosing a image to start deploying it? (Also some suggestion from tom to get me started would be happily received).

    Tom, where can I change the image format? If I do so, do I need a newer version of fog to deploy this image again? And last, since you are using partclone to do the imaging, is it possible to deploy this image with another image tool that also use partclone?


  • Senior Developer

    Splitting the image is actually supported on fog already. Its not fully integrated as a functional part of fog, but it can be done really easily. Change the image format from 0 to 2 and upload it. It will split the files into 200mb chunks. The fog scripts also use this to recombine these files. As for not making it require nfs, it gets slightly more tricky. What I’m not understanding though is why you’d want to fog without network. This is what fog was designed to do. Image using network is faster than usb or CD based imaging. It feels like a step back imo. Iknow others have been asking. For this same type of thing and there’s even been cases of people working and getting this.


  • Developer

    FOG is made to read images from a NFS server or via multicast. I am sure it is possible to change fog.download script to make it restore an image that resides on the USB stick. Splitting the image files should also be possible I think! But you’d need some bash scripting skills to do that. Maybe you want to look into that provide your solution to the community as others might ask for this too.

    Let me know if you want to look into it and I can point you the right way and give you some hints!! Depending on your skills this can be done in a few hours I reckon :-)


Log in to reply
 

443
Online

39174
Users

10821
Topics

102951
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.