Use of "autohostname" in GRUB menu item
A partition and disk imaging/cloning program
Brought to you by:
steven_shiau
Hi, thanks for this great tool!
I created a GRUB entry to start Clonezilla. It performes an automatic backup with the settings set in the GRUB menu. Working fine!
But I was wondering if I could use "autohostname" for image creation when using "savedisk". Currently it works with "autoname" and a hardcoded name, but "autohostname" isn't being resolved.
I tested with the following versions
stable - 2.7.0-10
alternative testing - 20201124-groovy
I used the following snippet:
menuentry "Clonezilla - My Menu Item for automatic Backup"{ search --set -f /live/vmlinuz linux /live/vmlinuz boot=live union=overlay username=user config components quiet noswap edd=on nomodeset nodmraid noeject locales=de_DE.UTF-8 keyboard-layouts=de ocs_prerun="mount PARTUUID=23dc0206-02 /home/partimag/" ocs_live_run="ocs-sr -q2 -j2 -z1p -p poweroff savedisk autohostname nvme0n1" ocs_live_extra_param="" ocs_live_batch=no vga=785 ip= nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1 initrd /live/initrd.img }
Push :(
As mentioned here:
https://clonezilla.org/advanced/reserved-word-ocs-sr.php
"it will automatically use IP address of network card to get the FQDN from DNS server, then append the date and time. "
Hence you have to setup network first (e.g., use ocs_prerun="dhclient -v eth0"), and the IP address should have a FQDN, which can be obtained from DNS.
Steven
Thanks a lot for your answer. I did not get it to work with autohostname because wlan does not start on my laptop. But I wanted autohostname mainly because it's the only feature that includes the date in the image name.
Is there a way to combine autoproductname with date in the image name? This would be the best way for me because it does not require networking to start up.
Last edit: Christopher S 2020-12-17
OK, sure. We will implement that in the next testing release.
Thanks for this idea.
Steven
Oh wow, that would be great! Thank you!
Please give Clonezilla live >= 2.7.1-5 or 20201222-* a try:
https://clonezilla.org/downloads.php
The reserved name "autoname-wpfx=" can be used for saving. It can be used to automatically generate an image name based on the prefix and time. E.g., autoname-wpfx=fox, then the image is like: fox-2020-1222-2059-img.
Let us know the results. Thanks.
Steven
Hi Steven,
I would also appreciate the wish from Christopher "Is there a way to combine autoproductname with date in the image name?".
I'm using the autoproductname during PXE boot for an autobackup option.
If there would be an option to implement date with computername it would be great.
In case I can also tell my whiches, I would like to see a result like that "2020-12-23--1103-computermodel".
At the moment I rename manually the folder after the backup is done.
Thank you.
psysmile
Hi, first of all thanks for your work. I tried with
clonezilla-live-2.7.1-5-amd64.zip
. But I it does not work. I tried different things likeand I tried to use autoname-wpfx as parameter like
but it didn't work.
Can you clarify how to use the reserved name?
Last edit: Christopher S 2020-12-25
Hi Christopher,
I do not know if I can help you, but my menu looks like that and is working:
Regards,
psysmile
Hi,
but you don't use the feature autoname-wpfx right? That's what I tried and I couldn't get it to work.
Last edit: Christopher S 2020-12-25
Please make ocs_live_run as:
ocs_live_run="ocs-sr -q2 -j2 -z1p -p poweroff savedisk autoname-wpfx=chrisux310uak serialno=xyz"
Steven
Hi Steven,
I changed the Grub menu item accordingly but it when clonezilla is starting.
But the message is shown for under a second so I cannot see what's going on.does not work. I can see
something like "q2 blabla command not found"
Is there a log file storing those messages on startup for further analysis?
I couldn't find anything in /var/log saying something like "command not found".
Last edit: Steven Shiau 2020-12-25
Did you try to run the command in Clonezilla live command line prompt?
sudo ocs-sr -q2 -j2 -z1p -p poweroff savedisk autoname-wpfx=chrisux310uak serialno=xyz
What's the error message on the screen?
Steven
I tried the command line prompt and it worked. Clonezilla generates the new image name and it looks good. But something is wrong with the GRUB menu item. I could not get it to work.
I double checked the GRUB config by resetting it to its working version. Then I did the change carefully. I know have
The first menu item produces an output something like "-q2: Command not found". But I cannot get the full message because it is cleared in under a second. Plus that, Clonezilla does not start the backup procedure but shows a menu with options "Start Clonezilla" and "Enter shell".
To be sure the GRUB config is okay I checked the second menu item and it works but without the autoname-wpfx feature.
Am I missing something?
The issue is on the function parse_cmdline_option from drbl-functions. It fails to parse the boot parameters with two or more "=" in a ocs parameter, especially from grub. This is the case you have, which is shown in /proc/cmdline as:
"ocs_live_run=ocs-sr -q2 -j2 -z1p -p poweroff savedisk autoname-wpfx=chrisux310uak serialno=xyz"
I will fix it.
Steven
Hey cool, glad you can fix it :)
@Christopher S,
I have uploaded Clonezilla live 2.7.1-8 and 20201228-*, so you can give it a try.
However, to combine your need and what psysmile suggested, We have implemented a new way and dropped the "autoname-wpfx=" mechanism.
As mentioned in the changelog:
Support customized auto-gen image name in the saving mode.
Key name: productname, FQDN, UUID, MAC, year, date, time (case insensitive).
It can be any combination, just make beginning with "autoname-".
If key name is not any one of the above, it will be shown as itself.
E.g., autoname-fox-year-date-time-uuid ->
fox-2020-1227-2336-564d41fc-9d80-20ac-c844-bda6a392d4c6
So now in your case, it can be like:
ocs_live_run="ocs-sr -q2 -j2 -z1p -p poweroff savedisk autoname-chrisux310uak-year-date-time-img serialno=xyz"
@psysmile,
What you requested I believe you can make it like:
autoname-productname-year-date
or
autoname-year-date-productname
Please let us know the results.
Steven
Last edit: Steven Shiau 2020-12-29
Hi Steven,
autoname-year-date-productname is perfectly working and exactly what I need.
Thank you very much for that solution :-)
Will this solution be implemented in the stable version?
Regards
psysmile
psysmile,
Thanks for confirming it's working for you.
If we do not find any better idea, definitely this feature will be used in the next stable release.
Steven
Hi Steven,
I tested Clonezilla live 2.7.1-8 with a full backup and it works fine!
Nice feature to customize the image name this way. Very flexible solution.
Thanks for your work!
Great! Thanks for your confirmation.
Steven