ubuntu 20.04 live server용 이미지 다운로드
# wget https://releases.ubuntu.com/20.04.4/ubuntu-20.04.4-live-server-amd64.iso
해당 이미지의 파일로 다운 받는다. 그렇지 않으면 cloud-init이 동작하지 않을 수 있다.
iso 파일의 내부 파일을 디렉토리로 복사
# mkdir iso-mount
# mkdir iso-files
# mount ubuntu-20.04.4-live-server-amd64.iso iso-mount
# rsync -rtlv iso-mount/ iso-files/
iso를 재구성하기 위한 패키지 설치
apt install -y p7zip-full xorriso isolinux
iso-files 디렉토리의 파일을 신규 iso로 만드는 방법
# md5sum iso-files/.disk/info > iso-files/md5sum.txt
# sed -i 's|iso-files/|./|g' iso-files/md5sum.txt
# mv iso-files/ubuntu .
# (cd iso-files; find '!' -name "md5sum.txt" '!' -path "./isolinux/*" -follow -type f -exec "$(which md5sum)" {} \; > ../md5sum.txt)
# mv md5sum.txt iso-files/
# mv ubuntu iso-files
# xorriso -as mkisofs -r \
-V Ubuntu\ custom\ amd64 \
-o ubuntu-20.04.4-live-server-amd64-custom.iso \
-J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
-boot-load-size 4 -boot-info-table \
-eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot \
-isohybrid-gpt-basdat -isohybrid-apm-hfsplus \
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
iso-files/boot iso
아래와 같이 실형 결과가 만들어지고 iso 파일이 만들어진다.
# xorriso -as mkisofs -r \
> -V Ubuntu\ custom\ amd64 \
> -o ubuntu-20.04.4-live-server-amd64-custom.iso \
> -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
> -boot-load-size 4 -boot-info-table \
> -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot \
> -isohybrid-gpt-basdat -isohybrid-apm-hfsplus \
> -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
> iso-files/boot iso
xorriso 1.5.2 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev 'stdio:ubuntu-20.04.4-live-server-amd64-custom.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 458g free
xorriso : WARNING : -volid text problematic as automatic mount point name
xorriso : WARNING : -volid text does not comply to ISO 9660 / ECMA 119 rules
Added to ISO image: directory '/'='/data/iso-boot/iso-files/boot'
xorriso : UPDATE : 261 files added in 1 seconds
Added to ISO image: directory '/'='/data/iso-boot/iso'
xorriso : UPDATE : 1025 files added in 1 seconds
xorriso : NOTE : Copying to System Area: 432 bytes from file '/usr/lib/ISOLINUX/isohdpfx.bin'
libisofs: WARNING : Cannot add /dists/stable to Joliet tree. Symlinks can only be added to a Rock Ridge tree.
libisofs: WARNING : Cannot add /dists/unstable to Joliet tree. Symlinks can only be added to a Rock Ridge tree.
libisofs: WARNING : Cannot add /ubuntu to Joliet tree. Symlinks can only be added to a Rock Ridge tree.
libisofs: NOTE : Automatically adjusted MBR geometry to 1012/79/32
libisofs: NOTE : Aligned image size to cylinder size by 450 blocks
xorriso : UPDATE : 3.41% done
xorriso : UPDATE : 28.99% done
xorriso : UPDATE : 53.22% done
xorriso : UPDATE : 93.71% done
ISO image produced: 639584 sectors
Written to medium : 639584 sectors at LBA 0
Writing to 'stdio:ubuntu-20.04.4-live-server-amd64-custom.iso' completed successfully.