I am trying to include a custom folder for the creation of a USB recovery drive.
I use the -u option to include a folder (which contains a couple subfolders) and so far, on the zip file, it (almost) works great.
I get an autorun.inf, two subfolders which are accessible to windows -- awesome right?
Well.. almost
I can't readily access them from INSIDE the linux/clonezilla environment.
Flash over to ISO/RUFUS creation - now i have a folder under /home which contains all my stuff... which after digging can be found by windows, but doesn't apply my icon, or set up the folder structure for the windows scripts that are there... BUT I can access them inside the linux/clonezilla environment.
Some things I've observed:
the -u (--include-directory) seems to only allow ONE directory to be included.
my image is about 17gb, so I get errors, and it forces using .tar.gz (so Rufus/Balena Etcher etc doesn't know what to do with it). So I must use the manual process.
I'm about to re-test it (my home/partimag was showing up as empty when I tried making a "blank" image that I could drop the image folder into later.. but that's basically it.
tl;dr:
ZIP - nice folder handling on the USB, but folders not visible inside Clonezilla, larger image sizes force using .tar.gz, which can't feed windows tools
ISO - less nice folder handling, but folders visible inside Clonezilla, windows tools work great with them.
It'd be awesome if we could combine the best of both -- that generating the ISO would also place the folder copy into the root, and the ZIP would also copy to /home/partimag
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Creating the ZIP/ISO works fine for the generalized clonezilla restore ISO -- I'm trying to do as light a touch for the user as possible, so I've got a few things that I'm baking in to the usb drive:
Everything in this doc works as expected for running "wizard mode"
My challenge comes in doing the custom folder with the -u option.
zip option puts stuff in the root of the zip nicely, iso option does not do so, it "fails processing" on the first item in the folder.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Works GREAT with zip generation -- puts all the files and subfolders in the root of the drive.
With ISO, it puts it in a folder called usbfiles.
I've tested and the disk works after I move the files/folders around.. but I have to do that manually each time I regenerate the iso/zip
The system reload works wonderfully, but I'd love to extend it a little further with custom scripting after the OCS process
1) get an exit condition indicating which drive was the target (note the ask_user part)
2) run an expect script based on the exit condition to do the GPT sizing fix (we have our base image run against a 60gb drive, and we extend to fit whatever the physical drive is)
3) run Dell CCTK in a script to change the bios boot options back to UEFI/HardDrive etc..
4) reboot with confirmation
The rest of the resize/customization I do inside the windows image.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am working on adding the ocs_postrun to the iso creation right now.
We have a mix of sata and nvme targets, and I use ASK_USER to get the image out to the correct drive (gets even more exciting with Intel Optane)...
We use gpt/uefi Windows 10 images, so we need to run parted to do the gpt fix that allows the system to use all the drive space.
I'd like to use that drive target chosen by the ask_user to feed the ocs_postrun command that runs parted (again.. very light touch.. they should choose the drive once, and then resize happens without additional input)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
cctk runs from the customized squashfs (had to jump through some hoops to get the dependencies working)
working to bring it all together, and going back to my original post...
Generating from ocs-iso, I get the usbfiles folder in the root of the ISO
Generating from ocs-live-dev, I get the contents in the root of the zip (but it's not playing nice yet on my usb stick... still working through that)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
it seems that my ocs_postrun of my expect script and dell cctk scripts are running, but I can't really tell without double checks -- even though I have pauses at the end of each, they just don't show up.
If I exit to cmd, and do my checks, they appear to have run though.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Menu options in syslinux, isolinux and grub.cfg to present the same menu:
1) restore with ask_user and confirmation of the "baked in image", expect script running after to perform gpt fix, and reset BIOS to correct RAID/UEFI/Boot from hard disk options.
2) Take a backup and store it on my network drive
3) Launch "basic" clonezilla connected to the network drive
4) Launch "basic" clonezilla
Here are the files that I keep in "usbfiles"
customized filesystem.squashfs with Dell Command Configure (cctk) installed to allow changing boot modes of the machines
linuxprep folder with expect script and dell bios set script
winprep folder with Microsoft USMT, powershell scripts to manage backing up user profiles, and windows cctk to set bios to boot from usb stick
boot - grub.cfg
syslinux - isolinux and syslinux
autorun.inf, autorun.hta and "RunMeFirst.bat"
When you run an hta in Windows, by default it opens with the 32 bit mshta.exe renderer.
The RunMeFirst calls the 64-bit mshta (which absolutley counterintuitively lives in system32). If you don't do this the powershell scripts do not modify the registry autologon and runonce features.
autorun.inf doesn't work any more to auto-launch the usb stick, but it DOES still give you a pretty/long name for the stick, as well as let you set the icon.
My "gold source" is a Microsoft Hyper-V image, and this is what leaves me with what I hope is the last piece of the puzzle.
Now that I have a nice clean USB stick, I need to push it back to an ISO. Hyper-V cannot readily boot from a USB drive. So ideally I need to make an ISO with the exact structure that I now have on my usb stick.
I run Ubuntu shell inside Windows, so I don't easily have access to the usb stick as a device, so doing dd to create the .iso is problematic.
What I'd like to do is copy the file/folder structure down and then use xorriso to generate the iso (the same way ocs-iso seems to work)
If there are some additional options to the ocs-iso that I'm not understanding, that'd be a welcome solution as well.
Thanks!
Last edit: Roger H 2019-02-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
looks like to make this work, put sudo in front of the xorriso (testing now)... otherwise the postrun command just fails when run from the grub/syslinux menu item.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"If I call it from the ocs_prerun, I get a size failure (Image size exceeds free space)." -> Could you please take a photo about the messages on the screen then post it?
Thanks.
Steven
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Howdy All,
I am trying to include a custom folder for the creation of a USB recovery drive.
I use the -u option to include a folder (which contains a couple subfolders) and so far, on the zip file, it (almost) works great.
I get an autorun.inf, two subfolders which are accessible to windows -- awesome right?
Well.. almost
I can't readily access them from INSIDE the linux/clonezilla environment.
Flash over to ISO/RUFUS creation - now i have a folder under /home which contains all my stuff... which after digging can be found by windows, but doesn't apply my icon, or set up the folder structure for the windows scripts that are there... BUT I can access them inside the linux/clonezilla environment.
Some things I've observed:
the -u (--include-directory) seems to only allow ONE directory to be included.
my image is about 17gb, so I get errors, and it forces using .tar.gz (so Rufus/Balena Etcher etc doesn't know what to do with it). So I must use the manual process.
I'm about to re-test it (my home/partimag was showing up as empty when I tried making a "blank" image that I could drop the image folder into later.. but that's basically it.
tl;dr:
ZIP - nice folder handling on the USB, but folders not visible inside Clonezilla, larger image sizes force using .tar.gz, which can't feed windows tools
ISO - less nice folder handling, but folders visible inside Clonezilla, windows tools work great with them.
It'd be awesome if we could combine the best of both -- that generating the ISO would also place the folder copy into the root, and the ZIP would also copy to /home/partimag
The Tar/GZ extract isn't behving like the iso... ISO gets grub menu, and then right into Clonezilla with options prepopulated.
Tar/GZ goes by way to fast
"The jobs in /etc/ocs/ocs-live.d/ are finished. Start "ocs-live-restore" now and then a multiple screen wall of text with usage info.
Have you checked this doc?
https://clonezilla.org/show-live-doc-content.php?topic=clonezilla-live/doc/04_Create_Recovery_Clonezilla
Any issue to use the steps mentioned in this doc?
Steven
Creating the ZIP/ISO works fine for the generalized clonezilla restore ISO -- I'm trying to do as light a touch for the user as possible, so I've got a few things that I'm baking in to the usb drive:
Everything in this doc works as expected for running "wizard mode"
My challenge comes in doing the custom folder with the -u option.
zip option puts stuff in the root of the zip nicely, iso option does not do so, it "fails processing" on the first item in the folder.
ocs-iso -g en_US.UTF-8 -t -k NONE -u usbfiles/. -e "-g auto -e1 auto -e2 -r -j2 -c -scr -p choose restoredisk baseload ask_user" baseload
ocs-live-dev -c -g en_US.UTF-8 -t -k NONE -u /home/partimag/usbfiles/. -e "-g auto -e1 auto -e2 -r -j2 -c -scr -p choose restoredisk baseload ask_user" baseload
Works GREAT with zip generation -- puts all the files and subfolders in the root of the drive.
With ISO, it puts it in a folder called usbfiles.
I've tested and the disk works after I move the files/folders around.. but I have to do that manually each time I regenerate the iso/zip
The system reload works wonderfully, but I'd love to extend it a little further with custom scripting after the OCS process
1) get an exit condition indicating which drive was the target (note the ask_user part)
2) run an expect script based on the exit condition to do the GPT sizing fix (we have our base image run against a 60gb drive, and we extend to fit whatever the physical drive is)
3) run Dell CCTK in a script to change the bios boot options back to UEFI/HardDrive etc..
4) reboot with confirmation
The rest of the resize/customization I do inside the windows image.
I'm seeing the "-m ./custom-ocs" option, but I'm not clear if I could do custom post-run exit scripting.
In addition, I need to figure out how to install dell command-configure into the base image :)
ocs_prerun and ocs_postrun... Do those work for the iso/live version or are they just drbl/server options?
Yes, they work for Clonezilla live iso or zip file. Just add that to your boot parameters.
Ref: https://clonezilla.org/fine-print-live-doc.php?path=./clonezilla-live/doc/99_Misc/00_live-boot-parameters.doc#00_live-boot-parameters.doc
Steven
I am working on adding the ocs_postrun to the iso creation right now.
We have a mix of sata and nvme targets, and I use ASK_USER to get the image out to the correct drive (gets even more exciting with Intel Optane)...
We use gpt/uefi Windows 10 images, so we need to run parted to do the gpt fix that allows the system to use all the drive space.
I'd like to use that drive target chosen by the ask_user to feed the ocs_postrun command that runs parted (again.. very light touch.. they should choose the drive once, and then resize happens without additional input)
I was reading this thread from, 2016: https://sourceforge.net/p/clonezilla/discussion/Clonezilla_live/thread/b2ce5c43/
Which, at the time indicated that ocs_prerun/postrun was not running in ocs-iso.
Has that been changed?
Can they be added with the -x / --extra-boot-param switch?
Last edit: Roger H 2019-02-11
I've just finished installing the Dell cctk stuff into a customized filesystem.squashfs, about to test it out and see if it works.
I tested the -x with :
ocs-live-dev -z -c -g en_US.UTF-8 -t -k NONE -u /home/partimag/usbfiles/. -x "ocs_postrun1=""sudo parted /dev/sda print Fix"""
I checked syslinux and the ocs_postrun element is in there, it got close:
append initrd=/live/initrd.img boot=live union=overlay username=user hostname=cosmic config components ocs_postrun1=sudo parted /dev/sda print Fix noswap edd=on nomodeset noeject
it didn't pull the quotes.
Trying again single quoting the postrun statement
Last edit: Roger H 2019-02-11
single quoting the postrun as
-x 'ocs_postrun1="sudo parted /dev/sda print Fix"'
made the isolinux.cfg:
append initrd=/live/initrd.img boot=live union=overlay username=user hostname=cosmic config components ocs_postrun1="sudo parted /dev/sda print Fix"
The USB disk is accessible as:
/run/live/medium
cctk runs from the customized squashfs (had to jump through some hoops to get the dependencies working)
working to bring it all together, and going back to my original post...
Generating from ocs-iso, I get the usbfiles folder in the root of the ISO
Generating from ocs-live-dev, I get the contents in the root of the zip (but it's not playing nice yet on my usb stick... still working through that)
it seems that my ocs_postrun of my expect script and dell cctk scripts are running, but I can't really tell without double checks -- even though I have pauses at the end of each, they just don't show up.
If I exit to cmd, and do my checks, they appear to have run though.
It appears that the 13th line of /var/log/clonezilla.log has the drive name as the first token... now to go unbury sed and awk scripting.
target=$(awk -v line=13 -v field=1 'NR==line{print $field}' /var/log/clonezilla.log)
Last edit: Roger H 2019-02-13
OK.. hopefully in the endstage now :)
I have a well customized flash drive:
Menu options in syslinux, isolinux and grub.cfg to present the same menu:
1) restore with ask_user and confirmation of the "baked in image", expect script running after to perform gpt fix, and reset BIOS to correct RAID/UEFI/Boot from hard disk options.
2) Take a backup and store it on my network drive
3) Launch "basic" clonezilla connected to the network drive
4) Launch "basic" clonezilla
Here are the files that I keep in "usbfiles"
customized filesystem.squashfs with Dell Command Configure (cctk) installed to allow changing boot modes of the machines
linuxprep folder with expect script and dell bios set script
winprep folder with Microsoft USMT, powershell scripts to manage backing up user profiles, and windows cctk to set bios to boot from usb stick
boot - grub.cfg
syslinux - isolinux and syslinux
autorun.inf, autorun.hta and "RunMeFirst.bat"
When you run an hta in Windows, by default it opens with the 32 bit mshta.exe renderer.
The RunMeFirst calls the 64-bit mshta (which absolutley counterintuitively lives in system32). If you don't do this the powershell scripts do not modify the registry autologon and runonce features.
autorun.inf doesn't work any more to auto-launch the usb stick, but it DOES still give you a pretty/long name for the stick, as well as let you set the icon.
My "gold source" is a Microsoft Hyper-V image, and this is what leaves me with what I hope is the last piece of the puzzle.
Now that I have a nice clean USB stick, I need to push it back to an ISO. Hyper-V cannot readily boot from a USB drive. So ideally I need to make an ISO with the exact structure that I now have on my usb stick.
I run Ubuntu shell inside Windows, so I don't easily have access to the usb stick as a device, so doing dd to create the .iso is problematic.
What I'd like to do is copy the file/folder structure down and then use xorriso to generate the iso (the same way ocs-iso seems to work)
If there are some additional options to the ocs-iso that I'm not understanding, that'd be a welcome solution as well.
Thanks!
Last edit: Roger H 2019-02-14
I think I've got it.
I run xorriso from the clonezilla iso to make sure everything works
I copied my clean USB disk down to the network drive, where I map out /home/partimag.
make_my_iso.sh
Last edit: Roger H 2019-02-14
looks like to make this work, put sudo in front of the xorriso (testing now)... otherwise the postrun command just fails when run from the grub/syslinux menu item.
well sudo in the command didn't work... testing an adjustment to the -o line:
/home/partimag/mycustomclonezilla.iso.
yep.. that did the trick.
yep.. that did the trick.
I have the make_iso.sh under my boot option, with an ocs_postrun.
After I make the image, I make a symbolic link out in my usb_baseline folder, and then I push a new iso.
If I call it from command line, works great.
If I call it from the ocs_prerun, I get a size failure (Image size exceeds free space).
"If I call it from the ocs_prerun, I get a size failure (Image size exceeds free space)." -> Could you please take a photo about the messages on the screen then post it?
Thanks.
Steven