You are not logged in.

#1 2020-08-17 03:01:32

GI Jack
Member
Registered: 2010-12-29
Posts: 92

disk-image-scripts

https://github.com/GIJack/disk-image-scripts

Disk Image Scripts go hand in hand for setting up and exporting disk images. Use case is they go hand in hand with arch-install-scripts to easily create and export Arch installs in .img files. Ideally for re-import as cloud templates:

So far this is mostly done, and I'll wind up adding tags and making a PKGBUILD in aur.

As of now, only MBR and EXT4 are supported, but I might add GPT and XFS support in future releases.


Scripts:

init_image.sh

- creates an image, partitioned and formatted with ext4

mount_image.sh

- sets up loop and mount, readies the image for pacstrap, also has a umount for clean up and list command for mounts in use.

shrinkwrap_image.sh

- shrinks image, partition and file system to smallest possible size, with optional gzip. prepare image for export to the cloud or other service that can read a raw disk utility.

Bootstrapping an arch system:

init_image.sh -s 15000 arch_linux.img # Creates a new image, 15GB in size 
mount_image mount arch_linux.img # setup the loop and mount 
pacstrap ~/mnt base linux vi syslinux cloud-init cloud-utils openssh # base system install

base system configure

sudo arch-chroot ~/mnt << EOF
systemctl enable cloud-init cloud-final cloud-config sshd systemd-networkd
sed -i s/sda3/vda1/g /boot/syslinux/syslinux.cfg
EOF

mount_image umount 0 # umount and destroy loop. Be sure to check this number with mount_image list

shrinkwrap_image.sh -z arch_linux.img 

# suck the all the free space(Shrinkwrap) out of the image and compress it with gzip. You can now upload this to a cloud provider, and use this as a template

Last edited by GI Jack (2020-08-18 02:18:28)

Offline

#2 2020-08-17 04:02:34

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,222
Website

Re: disk-image-scripts

1) Please do not use the "announce" prefix to your post; this is not an official tool or announcement.
2) Please use code tags to format your posts.

Offline

Board footer

Powered by FluxBB