Linux
--
Questions
--
Followers
Top Experts
I am trying to create an ISO file with grub-mkrescue command and trying to compress the iso file using:
grub-mkrescue --compress=xzcommand, but it does not compress the iso file.
Can anyone help to make the ISO compress to max using grub-mkrescue command.
Thanks
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
In some version there was an issue with xz, but that's been a while so I imagine it's fixed. Maybe a module that is missing for the compression?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Maybe there's another way to do it...
grub-mkrescue --compress=xz -o NewFile.iso /mnt/cdrom/ Â /mnt/cdrom/boot/boot.cat
Thanks .... ;)

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
grub-mkrescue -C=xz -o NewFile.iso /mnt/cdrom/ /mnt/cdrom/boot/boot.cat
I'll see what else is a possible solution.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Do you have grub2-mkrescue or grub-mkrescue? Do you have xorriso installed?
Man page of grub-mkrescue does not show the compression option.
[root@localhost tmp]# grub2-mkrescue -o test.iso /dev/sr0
Enabling BIOS support ...
Enabling i386-efi support ...
xorriso 1.4.0 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev 'stdio:test.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 8859m free
Added to ISO image: directory '/'='/tmp/tmp.gDDvjXojMC'
xorriso : UPDATE : 553 files added in 1 seconds
Added to ISO image: file '/sr0'='/dev/sr0'
xorriso : UPDATE : 554 files added in 1 seconds
xorriso : NOTE : Copying to System Area: 512 bytes from file '/usr/lib/grub/i386-pc/boot_hybrid.img'
xorriso : UPDATE : 12.21% done
ISO image produced: 7652 sectors
Written to medium : 7652 sectors at LBA 0
Writing to 'stdio:test.iso' completed successfully.
[root@localhost tmp]# grub2-mkrescue --compress=xz -o test2.iso /dev/sr0
Enabling BIOS support ...
Enabling i386-efi support ...
xorriso 1.4.0 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev 'stdio:test2.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 8839m free
Added to ISO image: directory '/'='/tmp/tmp.wjKSTNj5n2'
xorriso : UPDATE : 553 files added in 1 seconds
Added to ISO image: file '/sr0'='/dev/sr0'
xorriso : UPDATE : 554 files added in 1 seconds
xorriso : NOTE : Copying to System Area: 512 bytes from file '/usr/lib/grub/i386-pc/boot_hybrid.img'
xorriso : UPDATE : 17.58% done
ISO image produced: 4652 sectors
Written to medium : 4652 sectors at LBA 0
Writing to 'stdio:test2.iso' completed successfully.
[root@localhost tmp]# ls -l tes*iso
-rw-r--r--. 1 root root 9527296 May 29 17:22 test2.iso
-rw-r--r--. 1 root root 15671296 May 29 17:22 test.iso
Thank you for your help .....
--core-compress=xz

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Did you mention what Distro you are using? Ubuntu or something else, and what version...
Well, you don't need to install Grub2, but it might work in compressing the ISO, so ...
To upgrade the legacy Grub on Ubuntu you can follow this guide






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
grub-install -V
grub-install (GRUB) 2.02~beta2-9ubuntu1.2
- for grub2-mkrescue I am getting the below error:
grub2-mkrescue: command not found
I Installed latest Ubuntu, version 14
http://www.ubuntu.com/download/desktop

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
#xorriso -version
xorriso 1.3.2 : RockRidge filesystem manipulator, libburnia project.
[root@localhost bin]# xorriso -version
xorriso 1.4.0 : RockRidge filesystem manipulator, libburnia project.
xorriso 1.4.0
ISO 9660 Rock Ridge filesystem manipulator and CD/DVD/BD burn program
Copyright (C) 2014, Thomas Schmitt <scdbackup@gmx.net>, libburnia project.
xorriso version : 1.4.0
Version timestamp : 2015.05.17.112001
Build timestamp : -none-given-
libisofs in use : 1.4.0 (min. 1.4.0)
libburn in use : 1.4.0 (min. 1.4.0)
libburn OS adapter: internal GNU/Linux SG_IO adapter sg-linux
libisoburn in use : 1.4.0 (min. 1.4.0)
Provided under GNU GPL version 3 or later, due to libreadline license.
There is NO WARRANTY, to the extent permitted by law.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Thank you for your quick prompts.
Here is the link
According to the Forum, the below command should produce the ISO, but i get errors:
grub-mkrescue -o pve-cd.iso dir-with-cd-data/ -z -r -volid 'PVE' -c boot/boot.cat
Thank you for taking the time ..... ;)

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
[root@localhost tmp]# grub2-mkrescue --compress=xz -o test.iso /mnt/cdrom/
Enabling BIOS support ...
Enabling i386-efi support ...
xorriso 1.4.0 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev 'stdio:test.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 8840m free
Added to ISO image: directory '/'='/tmp/tmp.oHzFwPw1GS'
xorriso : UPDATE : 553 files added in 1 seconds
xorriso : UPDATE : 12500 files added in 1 seconds
xorriso : UPDATE : 23800 files added in 2 seconds
Added to ISO image: directory '/'='/mnt/cdrom'
xorriso : UPDATE : 25669 files added in 3 seconds
xorriso : NOTE : Copying to System Area: 512 bytes from file '/usr/lib/grub/i386-pc/boot_hybrid.img'
libisofs: NOTE : Automatically adjusted MBR geometry to 1018/69/32
xorriso : UPDATE : 0.06% done
xorriso : UPDATE : 0.58% done
xorriso : UPDATE : 2.76% done
xorriso : UPDATE : 4.24% done, estimate finish Fri May 29 18:43:18 2015
xorriso : UPDATE : 4.97% done, estimate finish Fri May 29 18:43:29 2015
xorriso : UPDATE : 5.79% done, estimate finish Fri May 29 18:43:36 2015
xorriso : UPDATE : 6.68% done, estimate finish Fri May 29 18:43:40 2015
xorriso : UPDATE : 7.54% done, estimate finish Fri May 29 18:43:44 2015
xorriso : UPDATE : 8.53% done, estimate finish Fri May 29 18:43:46 2015
xorriso : UPDATE : 9.71% done, estimate finish Fri May 29 18:43:45 2015
xorriso : UPDATE : 10.89% done, estimate finish Fri May 29 18:43:45 2015
xorriso : UPDATE : 12.04% done, estimate finish Fri May 29 18:43:45 2015
xorriso : UPDATE : 12.56% done, estimate finish Fri May 29 18:43:48 2015
xorriso : UPDATE : 12.77% done, estimate finish Fri May 29 18:44:11 2015
xorriso : UPDATE : 12.98% done, estimate finish Fri May 29 18:44:20 2015
xorriso : UPDATE : 13.23% done, estimate finish Fri May 29 18:44:26 2015
xorriso : UPDATE : 13.52% done, estimate finish Fri May 29 18:44:33 2015
xorriso : UPDATE : 14.46% done, estimate finish Fri May 29 18:44:29 2015
...
xorriso : UPDATE : 95.64% done, estimate finish Fri May 29 18:44:16 2015
xorriso : UPDATE : 96.15% done, estimate finish Fri May 29 18:44:16 2015
xorriso : UPDATE : 96.77% done, estimate finish Fri May 29 18:44:16 2015
xorriso : UPDATE : 97.31% done, estimate finish Fri May 29 18:44:17 2015
xorriso : UPDATE : 98.17% done, estimate finish Fri May 29 18:44:17 2015
xorriso : UPDATE : 98.96% done
xorriso : UPDATE : 99.48% done
xorriso : UPDATE : 99.76% done
ISO image produced: 561743 sectors
Written to medium : 561743 sectors at LBA 0
Writing to 'stdio:test.iso' completed successfully.
[root@localhost tmp]#
The resulting test.iso file is about 1.1G - when you look at the compress option, it states it's compressing the grub files, so maybe it's not meant to compress the whole ISO after all.
maybe there is another utility needs to be used after creating the ISO?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Version 1.3.13
It works alright to create an ISO size, as the source, but when i try the new ISO, it boots up , after making the selection at the first menu i get this error:
chroot: can not execute /sbin/unconfigured.sh execute format error
We tired with another expert to solve this but we could not, maybe you can have a look please.
Thank for your time.
Yes the new ISO works alright, no issues there....
The original and the 1.1 GB ISO all the same in terms of contents ....
Just the way they are created makes the difference in size. ISOMASTER is able to create the same size.
I am trying to find a solution for the ISOMASTER error, since cannot get the comparison down to the original ISO size;
chroot: can not execute /sbin/unconfigured.sh execute format error
If the above error is solved, then all is good!! .....!!

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
So, maybe the issue has been fixed already .... ;)
[root@localhost cdrom]# du -h proxmox/
165M proxmox/packages
271M proxmox/
[root@localhost cdrom]# cd proxmox/
[root@localhost proxmox]# du -h *
3.0K country.dat
165M packages
512 pve-base.cnt
106M pve-base.tar
[root@localhost proxmox]# ls -l pve-base.tar
-r--r--r--. 1 root root 278333440 May 26 18:24 pve-base.tar
[root@localhost proxmox]#
[root@localhost cdrom2]# du -h proxmox/
167M proxmox/packages
432M proxmox/
[root@localhost cdrom2]# cd proxmox/
[root@localhost proxmox]# du -h *
6.5K country.dat
167M packages
512 pve-base.cnt
266M pve-base.tar
[root@localhost proxmox]# ls -l pve-base.tar
-r--r--r--. 1 root root 278333440 May 26 18:24 pve-base.tar
[root@localhost proxmox]#
On both ISO's the tar file is reported as 278333440 bytes but on the original ISO du reports as 106M?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Do that and look at the final file size of the gzip/zip file. That will tell you whether the ISO file has the capability of being compressed any further.
If the files on the source CD are already compressed for distribution, then chances are you cannot really compress them any further. There IS a limit to it all.
If someone gave you a big box that was stuffed full of crushed cars, and you tried to make a copy of it, your copy wouldn't be able to crush the contents any further than they already are.
Doing the gzip/zip exercise will tell you whether any compression algorithms will actually work for you.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
to create the same ISO. SO, in your terms, I am taking crush cars and trying to put them on the same box WITHOUT making any changes to the contents. Please note, I am not making any adding/modifications and changes. There is switch/option that increases compress level like  "
-zisofs level=9" Â see here:
http://libburnia-project.org/wiki/zisofs
There is a missing link.... ;)






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
After digging and searching, I found this Link.
So, by using mkzftree --force we can compress all the files but not the boot files.
So, i have compressed the files and then replace the uncompressed boot folder with the other compressed files, created an ISO by using:
grub-mkrescue --compress=xz -o NewFile.iso /mnt/cdrom/ Â /mnt/cdrom/boot/boot.cat
But I ended up with a black screen and a blinking curser. Before ISOlinux was used to create the bootable ISO, but this practice has been changed to grub on the last release of PROXMOX.
So, anyone can advise what other directory i need to make sure is not compressed so i can have a proper bootable ISO.
This is the link to the original ISO.
Thank you for your QUICK prompt and time.
You've got the original ISO. It looks like you've either burned it to a CD or mounted it virtually - but either way, you've got the resulting structure in /mnt/cdrom.
Now you're trying to create a new ISO based off of that result. If you have the original ISO, can I ask why you're trying to create a new ISO? Did you change the original ISO in some way that prevents you from using the original ISO, so now you want your new one? Or what's the end purpose here that keeps you from just using the original?
I feel like there's a key piece of information missing here.
Original ISO size= 664MB
Created a new ISO (with no editing/adding/removing...
How can get the same size as the original ISO?
Thanks ....

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Did you create the original ISO or are you reverse engineering?
Kindly, take few seconds to go through the above comments. I assure you, you will find all the Answers to your questions, in addition, you will discover where the issue is, especially this comment.
Thank you for your time.
I guess your next question will be  HOW I created it ...... If that is, please see above comments, every single steps have been explained in full....
Thanks






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
1. You have a link to the original ISO, which you did not create. The original ISO is 664 megabytes.
2. It looks like you mounted the original ISO in /mnt/cdrom and you are trying to recreate the ISO from the mounted image.
3. Using grub2-mkrescue to recreate the ISO gives you an ISO file that is 1.1 gigabytes instead of the original size.
4. Using ISOMASTER to recreate the ISO gives you the same file size but gives you an error message when you try to boot it.
You haven't answered several questions:
1. Did the 1.1 gigabyte ISO boot properly?
2. Did you compress the boot files when you tried to create the ISO (this could break the boot-up) ?
3. Did you ever compare the contents of the two .tar files that were different between original and recreated ISO files?
Kindly, see Below for corresponding  answers:
1) YES ... it did boot alright.
2)  Using mkzftree --force, compressed all the files but not the boot directory, I overwrite the compressed boot directory  with the uncompressed one from the original ISO.
3) they are in ISO format not tar. One expert and I have done the diff and found nothing. Later on, I found out that  the original ISO file is created as follows:
A)  the contents is compressed using  mkzftree command But
B) The boot files are not compressed
C) grub2-mkrescue is used to create the ISO format
I am stuck, for very long time now, on the B). trying to find out what else need(s) to be uncompressed like boot directory, so that the ISO can boot ....
Thank you for your time.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
>>> Any Idea which directory(s) and  file(s) need to be uncompressed after running  mkzftree command......
Thanks.
If the original ISO is more than 700 MB in size, i can not create an ISO anymore, since I will be over 4.7 GB limitation.
I don't understand your logic there. If it's 664 megs today and when you recreate it, it comes to 1.1 gigabytes, then you will probably have a similar (or better) ratio. Currently, that's about a 65% ratio. Worst case scenario, the ratio stays about the same and the original ISO would have to be 2.8 gigs before it would be recreated to 4.7 gigs. But that's not even a probable way of how that would play out.
If the original ISO is less than 700 megs today, it's probably going to stay that way in order to be able to burned onto a standard CD. If you want to add files and then burn the result onto a DVD, then you have lots of room to add files.
Regarding the tarballs, I was not talking about the ISOs, but rather the files INSIDE the ISO files - you had listed out an example of pve-base.tar, which had a different size between the original and re-created ISO versions. I was asking if you had done a file listing of the inside of that tarball to see what the difference was. (Maybe it was gzipped but without the .gz extension)
Anyway, it sounds like you might be burning to a DVD data disc instead of a CD, so if that's the case, then why is the 1.1 gig ISO a problem? You said it boots properly.
Please answer the following question:
I have an ISO file that can be found here, If I want to recreate a new ISO file without adding/modifying any files and directories into the original ISO, using the below command:
grub2-mkrescue -o newISOfile.iso /mnt/cdrom/ Â /mnt/cdrom/boot/boot.cat
I will get a bootable NEW ISO file of the Size 1.1 GB, but the original ISO is only 664MB.
and I DID NOT change anything in the original ISO files;
1) WHY?
2) How can i create a new ISO file with the same size .
Thanks






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Thanks.
I didn't post any further comments sofar because I did not have an idea until now as to why the new ISO is getting larger than the original. I'm thinking that the decompression is supported by the Linux kernel and that upon mounting, the ISO gets decompressed automatically. Compressing is obviously not handled automatically and is the real cause of the issue here. Maybe grub-mkrescue is not the right utility to do what is requested here and we need to look for another utility like xorriso for example.
Juts want to suggest that grub2-mkrescue uses xorriso by default.
Thank you again for your kind help.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
- Install zisofs-tools and genisoimage if you haven't already
- mount your ISO using: mount -o loop /mnt/cdrom /path/to/original.iso
- compress that tree to a new location using: mkzisofs /mnt/cdrom /tmp/cdrom_compressed
- create the (compressed) ISO image using: genisoimage -o /tmp/newimage.iso -r -z /tmp/cdrom_compressed
Look at the filesize of newimage.iso, I got 630Mb where the original was 650Mb
Mount the new image to /mnt/cdrom2 and compare the contents to /mnt/cdrom, burn and try booting the new image and let me know your findings.
Could you please review the below step, is not working for me, Thanks
- Compress that tree to a new location using: mkzisofs /mnt/cdrom /tmp/cdrom_compressed






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
This exactly as my comment here.
When mkzftree is used, it should not compress the boot section., like the [boot] directory.
So, we can compress all the files but the boot files and grub.
So, as i asked before which directories/Files should not be compressed, to get a bootable ISO?
Thanks.......
I would guess just the /boot folder and the efi.img file in the root folder.
It seems to me that the author wants to take an existing ISO and add/replace some files, but as a first step he has tried to recreate the original ISO so as to test the process, but this is giving him a bigger ISO image than he started with.
Not sure why this is a problem as it still fits on a DVD, but hey!

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
What do you think.....;)
Q:
B) The boot files are not compressed (from my earlier comment).
We need to find out what these files are: Â - [boot] directory
Then I found that  /usr/lib/grub/i386-pc/ is part of the boot process.
I am sure  if we can diff the files before and after the uncompress of the original ISO, the files with the same size are the ones not needed to be tree out....
The decompress is done in the kernel, so if you're sure that we can diff, how then?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Therefore, could we focus on the making the ISO bootable.
The "base ISO" should be  the proper size that I can add the 3.7GB of files to it.
Thanks.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Install zisofs-tools and genisoimage if you haven't already
- mount your ISO using: mount -o loop /mnt/cdrom /path/to/original.iso
- Compress that tree to a new location using: mkzisofs /mnt/cdrom /tmp/cdrom_compressed
- create the (compressed) ISO image using: genisoimage -o /tmp/newimage.iso -r -z /tmp/cdrom_compressed
Look at the filesize of newimage.iso, I got 630Mb where the original was 650Mb
the newimage.iso has perfect size but it is not bootable....
So...
Therefore, could we focus on the making the ISO bootable.
Why didnt you tell us that in the first place?
Great work. Finally a bootable ISO....!
However, Â I booted from the ISO, clicked on the install.... option in the menu, once, it loads the files into the memory, i get the attached snapshot.
I created an ISO by replacing the [boot] directory and all the files in the root like: COPYING,efi.img.....etc. total of 9 files. Then, used the VM, booted from the ISO file.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
You made such a perfect screenshot that I doubt you wrote ISO file to a physical DVD. Why not netboot? no squeeking mechanical parts involved....
First you need a bootable disk, there is no place for compression so far - a boot file that reads kernel and mkinitrd from ISO filesystem using BIOS facilities. So far so good - it works for you.
Why you compress boot loader code - I dont know. You save like 10MB compressing initrd and much less before that.
That mkinitrd must contain *ALL* possible CD drive attachment drivers, yours has only support for very old onboard intel PIIX IDE controllers. Not to mention it needs to treat all possible target disks same way.
I assume you manage drivers part and DISABLE compression at all early boot stages.
Now you either need a directory on CD with compressed packages (like centos, debian etc) or do extra leap to mount compressed filesystem image (like Mint or Mandriva or Suse does)
On copying, unless you take special precautions, the holes get filled in with zeroes.
I have never understood how these holes work - maybe you could google for files with holes or maybe sparse files
I will close and open up a new one ....
Thank you all for your great comments.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Linux
--
Questions
--
Followers
Top Experts
Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.