{"id":13602325,"url":"https://github.com/hartwork/image-bootstrap","last_synced_at":"2025-05-15T15:07:46.715Z","repository":{"id":775626,"uuid":"31793628","full_name":"hartwork/image-bootstrap","owner":"hartwork","description":" :partly_sunny: Creates Linux chroots and bootable virtual machine images; command line tool (Python 3)","archived":false,"fork":false,"pushed_at":"2025-05-10T20:29:29.000Z","size":1556,"stargazers_count":270,"open_issues_count":11,"forks_count":43,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-10T21:29:12.727Z","etag":null,"topics":["alpine-linux","arch-linux","archlinux","archlinux-images","block-device","bootstrap","centos","chroot","chroot-environment","cli","fedora","gentoo","install-script","installer","installers","linux","python","virtual-machine","virtualization","void-linux"],"latest_commit_sha":null,"homepage":"https://linuximages.sebastian.pipping.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hartwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-03-06T23:21:20.000Z","updated_at":"2025-05-10T20:29:33.000Z","dependencies_parsed_at":"2024-01-02T01:03:29.192Z","dependency_job_id":"982098f0-71e0-48e4-80b1-8b899b57783f","html_url":"https://github.com/hartwork/image-bootstrap","commit_stats":{"total_commits":934,"total_committers":13,"mean_commits":71.84615384615384,"dds":"0.36081370449678796","last_synced_commit":"6813af3c1f3e4c047e51b1d8a6908b38ecb2bd37"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hartwork%2Fimage-bootstrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hartwork%2Fimage-bootstrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hartwork%2Fimage-bootstrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hartwork%2Fimage-bootstrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hartwork","download_url":"https://codeload.github.com/hartwork/image-bootstrap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254364270,"owners_count":22058878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpine-linux","arch-linux","archlinux","archlinux-images","block-device","bootstrap","centos","chroot","chroot-environment","cli","fedora","gentoo","install-script","installer","installers","linux","python","virtual-machine","virtualization","void-linux"],"created_at":"2024-08-01T18:01:20.197Z","updated_at":"2025-05-15T15:07:41.699Z","avatar_url":"https://github.com/hartwork.png","language":"Python","readme":"[![Run the test suite](https://github.com/hartwork/image-bootstrap/actions/workflows/run-test-suite.yml/badge.svg)](https://github.com/hartwork/image-bootstrap/actions/workflows/run-test-suite.yml)\n\u003cbr/\u003e\n[![Smoke test creation of Alpine chroots](https://github.com/hartwork/image-bootstrap/actions/workflows/directory-bootstrap-alpine.yml/badge.svg)](https://github.com/hartwork/image-bootstrap/actions/workflows/directory-bootstrap-alpine.yml)\n\u003cbr/\u003e\n[![Smoke test creation of Arch chroots](https://github.com/hartwork/image-bootstrap/actions/workflows/directory-bootstrap-arch.yml/badge.svg)](https://github.com/hartwork/image-bootstrap/actions/workflows/directory-bootstrap-arch.yml)\n\u003cbr/\u003e\n[![Smoke test creation of Arch OpenStack images](https://github.com/hartwork/image-bootstrap/actions/workflows/image-bootstrap-arch.yml/badge.svg)](https://github.com/hartwork/image-bootstrap/actions/workflows/image-bootstrap-arch.yml)\n\u003cbr/\u003e\n[![Smoke test creation of Debian OpenStack images](https://github.com/hartwork/image-bootstrap/actions/workflows/image-bootstrap-debian.yml/badge.svg)](https://github.com/hartwork/image-bootstrap/actions/workflows/image-bootstrap-debian.yml)\n\u003cbr/\u003e\n[![Smoke test creation of Gentoo chroots](https://github.com/hartwork/image-bootstrap/actions/workflows/directory-bootstrap-gentoo.yml/badge.svg)](https://github.com/hartwork/image-bootstrap/actions/workflows/directory-bootstrap-gentoo.yml)\n\u003cbr/\u003e\n[![Smoke test creation of Gentoo OpenStack images](https://github.com/hartwork/image-bootstrap/actions/workflows/image-bootstrap-gentoo.yml/badge.svg)](https://github.com/hartwork/image-bootstrap/actions/workflows/image-bootstrap-gentoo.yml)\n\u003cbr/\u003e\n[![Smoke test creation of Ubuntu OpenStack images](https://github.com/hartwork/image-bootstrap/actions/workflows/image-bootstrap-ubuntu.yml/badge.svg)](https://github.com/hartwork/image-bootstrap/actions/workflows/image-bootstrap-ubuntu.yml)\n\u003cbr/\u003e\n[![Smoke test creation of Void chroots](https://github.com/hartwork/image-bootstrap/actions/workflows/directory-bootstrap-void.yml/badge.svg)](https://github.com/hartwork/image-bootstrap/actions/workflows/directory-bootstrap-void.yml)\n\n\n**Table of Contents**\n\n* [About](#About)\n* [History](#History)\n* [Installation](#Installation)\n* [Example run](#ExampleRun)\n* [Speeding things up](#SpeedingThingsUp)\n    * [Using RAM instead of HDD/SSD](#UsingRamInsteadOfDisk)\n    * [Apt-Cacher NG -- a cache specific to Debian/Ubuntu](#AptCacherNG)\n    * [Polipo -- a generic HTTP cache](#Polipo)\n    * [haveged -- an entropy generator](#haveged)\n* [Debian package](#DebianPackage)\n* [Usage (`--help` output)](#HelpOutput)\n* [Hints on using image-bootstrap within a pipe](#Piping)\n* [Known limitations](#KnownLimitations)\n    * [Installing to partition block devices](#PartitionBlockTarget)\n\n\n\u003ca name=\"About\"\u003e\u003c/a\u003e\n# About\n\nWelcome to the home of **image-bootstrap** (and its little brother **directory-bootstrap**).\n\n**image-bootstrap** is a command line tool to generate bootable virtual machine images\nand write them to a given _block device_.\u003cbr\u003e\nLinux distributions supported by **image-bootstrap** currently include:\nArch, Debian, Gentoo, Ubuntu.\u003cbr\u003e\nWhen passing the `--openstack` parameter, images are\n[prepared for use with OpenStack](http://docs.openstack.org/image-guide/content/ch_openstack_images.html).\n\n**directory-bootstrap** is a command line tool to install non-Debian Linux distributions\ninto a given _directory_ (similar to [debootstrap](https://wiki.debian.org/Debootstrap)\nfor Debian/Ubuntu).\u003cbr\u003e\nDistributions supported by **directory-bootstrap** currently include:\nAlpine Linux, Arch Linux, Gentoo, and Void Linux.\n\n\n\u003ca name=\"History\"\u003e\u003c/a\u003e\n# History\n\n**image-bootstrap** started out as a re-write of\n[grml-debootstrap](https://github.com/grml/grml-debootstrap).\nPrimarily, it can be used to create Debian/Ubuntu or Arch images ready to be launched as a virtual machine.\n\nIn comparison to grml-debootstrap, by now **image-bootstrap**\n\n * installs to block devices only,\n\n * supports several approaches to installing GRUB 2.x, or extlinux, or no bootloader at all,\n\n * does not leak the host's hostname into the resulting image,\n\n * supports passing the root password off the command-line\n   (and the eyes of other users and shell history),\n\n * supports using a custom `/etc/resolv.conf` file\n   (e.g. to not leak your home router model name from `/etc/resolv.conf` into the image),\n\n * has support for installing Arch Linux, Gentoo and Ubuntu (besides Debian),\n\n * is able to create\n   [OpenStack images](http://docs.openstack.org/image-guide/content/ch_openstack_images.html),\n\n * is written in Python rather than Bash/mksh, and\n\n * has more friendly terminal output.\n\n**directory-bootstrap** came into life with the arrival of support for Arch Linux.\nSupport for Gentoo followed, after.\nSupport for Void Linux ~and CentOS~ chroots came into live during 34c3, December 2017.\nSupport for Alpine Linux chroots came into in March 2018.\n\n\n\u003ca name=\"Installation\"\u003e\u003c/a\u003e\n# Installation\n\n\n## Via latest release from PyPI\n\n- a) `pipx install image-bootstrap`\n\n- b) `pip3 install --user --break-system-packages image-bootstrap`\n\n\n## Via Git `HEAD`\n\n- a) `pipx install git+https://github.com/hartwork/image-bootstrap`\n\n- b) `pip3 install --user --break-system-packages git+https://github.com/hartwork/image-bootstrap`\n\n\n## Extending `${PATH}`\n\nFor commands `image-bootstrap` and `directory-bootstrap` to be found, you'll need to extend `${PATH}`, e.g.:\n\n```bash\nexport PATH=\"${PATH}:${HOME}/.local/bin\"  # one-time or via ~/.bashrc\n\nimage-bootstrap --help\n```\n\n\n\u003ca name=\"ExampleRun\"\u003e\u003c/a\u003e\n# Example run\n\nThe following is a complete demo of installing Debian stretch to LVM volume `/dev/vg/lv`\nand launching the resulting image using KVM.\n\n```console\n# ${EDITOR} root_password.txt\n\n# sudo image-bootstrap --hostname stretch debian \\\n                                  --password-file root_password.txt /dev/vg/lv\n     _                          __             __      __\n    (_)_ _  ___ ____ ____  ___ / /  ___  ___  / /____ / /________ ____\n   / /  ' \\/ _ `/ _ `/ -_)/__// _ \\/ _ \\/ _ \\/ __(_-\u003c/ __/ __/ _ `/ _ \\\n  /_/_/_/_/\\_,_/\\_, /\\__/    /_.__/\\___/\\___/\\__/___/\\__/_/  \\_,_/ .__/\n               /___/                      v0.9.1 :: 2015-07-11  /_/\n\nSoftware libre licensed under AGPL v3 or later.\nBrought to you by Sebastian Pipping \u003csebastian@pipping.org\u003e.\nPlease report bugs at https://github.com/hartwork/image-bootstrap.  Thank you!\n\nSelected approach \"chroot-grub2-drive\" for bootloader installation.\nChecking for blkid... /sbin/blkid\nChecking for chmod... /bin/chmod\nChecking for chroot... /usr/sbin/chroot\nChecking for cp... /bin/cp\nChecking for debootstrap... /usr/sbin/debootstrap\nChecking for find... /usr/bin/find\nChecking for kpartx... /sbin/kpartx\nChecking for mkdir... /bin/mkdir\nChecking for mkfs.ext4... /sbin/mkfs.ext4\nChecking for mount... /bin/mount\nChecking for parted... /sbin/parted\nChecking for partprobe... /sbin/partprobe\nChecking for rm... /bin/rm\nChecking for rmdir... /bin/rmdir\nChecking for sed... /bin/sed\nChecking for tune2fs... /sbin/tune2fs\nChecking for umount... /bin/umount\nChecking for uname... /bin/uname\nChecking for unshare... /usr/bin/unshare\n\nChecking for known unsupported architecture/machine combination...\nChecking if \"/dev/vg/lv\" is a block device...\nReading root password from file \"/home/user1/root_password.txt\"...\nUnsharing Linux namespaces (mount, UTS/hostname)...\nPartitioning \"/dev/vg/lv\"...\nActivating partition devices...\nCreating file system on \"/dev/mapper/vg-lvp1\"...\nCreating directory \"/mnt/tmpFczeFl\"...\nMounting partitions...\nCreating directory \"/mnt/tmpFczeFl/etc\"...\nWriting file \"/mnt/tmpFczeFl/etc/hostname\"...\nWriting file \"/mnt/tmpFczeFl/etc/resolv.conf\" (based on file \"/etc/resolv.conf\")...\nBootstrapping Debian \"stretch\" into \"/mnt/tmpFczeFl\"...\nWriting file \"/mnt/tmpFczeFl/etc/hostname\"...\nWriting file \"/mnt/tmpFczeFl/etc/resolv.conf\" (based on file \"/etc/resolv.conf\")...\nWriting file \"/mnt/tmpFczeFl/etc/fstab\"...\nWriting file \"/mnt/tmpFczeFl/etc/network/interfaces\"...\nRunning pre-chroot scripts...\nMounting non-disk file systems...\nSetting root password...\nWriting device map to \"/mnt/tmpFczeFl/boot/grub/device.map\" (mapping \"(hd9999)\" to \"/dev/dm-8\")...\nInstalling bootloader to device \"/dev/vg/lv\" (actually \"/dev/dm-8\", approach \"chroot-grub2-drive\")...\nGenerating GRUB configuration...\nPost-processing GRUB config...\nGenerating initramfs...\nUnmounting non-disk file systems...\nCleaning chroot apt cache...\nRunning post-chroot scripts...\nUnmounting partitions...\nRemoving directory \"/mnt/tmpFczeFl\"...\nDeactivating partition devices...\nDone.\n\n# sudo kvm -hda /dev/vg/lv\n```\n\nWithout `--color never`, the output above is actually in color.\n\n\n\u003ca name=\"SpeedingThingsUp\"\u003e\u003c/a\u003e\n# Speeding things up\n\n\n\u003ca name=\"UsingRamInsteadOfDisk\"\u003e\u003c/a\u003e\n## Using RAM instead of HDD/SSD\n\nIf you run **image-bootstrap** repeatedly and have enough RAM, you may want to\ncreate images on RAM storage rather than on disk.  I use a setup with\n\n * a loop device (to have a block device)\n\n * over a sparse file (to save space)\n\n * in a tmpfs mount (to use RAM).\n\nFor example (assuming you have /tmp in RAM already):\n\n```console\n# sudo mount -o remount,size=6g /tmp\n# truncate --size 3g /tmp/disk3g\n# LOOP_DEVICE=\"$(losetup --show -f /tmp/disk3g)\"\n\n# image-bootstrap .... arch ... \"${LOOP_DEVICE}\"\n# qemu-img convert -p -f raw -O qcow2 \"${LOOP_DEVICE}\" /var/lib/arch-$(date -I).qcow2\n\n# losetup -d \"${LOOP_DEVICE}\"\n# rm /tmp/disk3g\n```\n\n\n\u003ca name=\"AptCacherNG\"\u003e\u003c/a\u003e\n## Apt-Cacher NG -- a cache specific to Debian/Ubuntu\n\nWhen creating multiple images,\na local instance of [Apt-Cacher NG](https://www.unix-ag.uni-kl.de/~bloch/acng/) and\npassing `--mirror http://localhost:3142/debian` to **image-bootstrap** may come in handy.\n\n\u003ca name=\"Polipo\"\u003e\u003c/a\u003e\n## Polipo -- a generic HTTP cache\n\nFor a distribution-agnostic cache, using\n[Polipo](https://github.com/jech/polipo) can greatly speed up consecutive runs.\nInvoke **image-bootstrap** with\n\n```console\n# http_proxy=http://127.0.0.1:8123/ image-bootstrap ...\n```\n\nwhen using Polipo with default port configuration.\n\n\u003ca name=\"haveged\"\u003e\u003c/a\u003e\n## haveged -- an entropy generator\n\nDuring image creation, cryptographic keys may need to be generated, e.g.\nfor the OpenSSH server, at least temporarily.  As key generation relies\non availability of entropy, image creation may take longer in environments that\nare slow at adding to the entropy pool.\nTo speed things up, running [haveged](http://www.issihosts.com/haveged/)\nat the host system _could_ be an option, especially since all keys should be deleted\nfrom images, eventually. Otherwise, there is a risk of ending up with multiple\nsystems having the same key allowing for attacks.\nI am unsure of the quality of entropy that haveged produces.  Use is at your own risk.\n\n\n\u003ca name=\"DebianPackage\"\u003e\u003c/a\u003e\n# Debian package\n\nAs long as **image-bootstrap** as not available _in_ Debian, you can\nmake an **image-bootstrap** Debian package yourself easily from Git as follows:\n\n```console\n# git clone https://github.com/hartwork/image-bootstrap.git\nCloning into 'image-bootstrap'...\n[..]\n\n# cd image-bootstrap/\n\n# debuild -uc -us --lintian-opts --display-info\n[..]\n\n# cd ..\n\n# ls *.deb\nimage-bootstrap_0.9.1_all.deb\n\n# sudo apt install ./image-bootstrap_0.9.1_all.deb\n[..]\n```\n\n\n\u003ca name=\"HelpOutput\"\u003e\u003c/a\u003e\n# Usage (`--help` output)\n\nIn general, the usage is:\n\n```console\nimage-bootstrap [..] DISTRIBUTION [..] DEVICE\n```\n\nor\n\n```console\nimage-bootstrap --hostname NAME [DISTRO_AGNOSTIC] DISTRIBUTION [DISTRO_SPECIFIC] DEVICE\n```\n\nin a bit more detail.\n\n\nA dump of the current `--help` output would be:\n```console\n# COLUMNS=80 image-bootstrap --help\nusage: image-bootstrap [-h] [--version] [--color {never,always,auto}]\n                       [--debug] [--quiet] [--verbose] [--arch ARCHITECTURE]\n                       [--bootloader {auto,chroot-grub2-device,chroot-grub2-drive,host-extlinux,host-grub2-device,host-grub2-drive,none}]\n                       [--bootloader-force] [--hostname NAME] [--openstack]\n                       [--password PASSWORD | --password-file FILE]\n                       [--resolv-conf FILE] [--disk-id ID]\n                       [--first-partition-uuid UUID] [--machine-id ID]\n                       [--scripts-pre DIRECTORY] [--scripts-chroot DIRECTORY]\n                       [--scripts-post DIRECTORY] [--grub2-install COMMAND]\n                       [--cache-dir DIRECTORY]\n                       DISTRIBUTION ... DEVICE\n\nCommand line tool for creating bootable virtual machine images\n\npositional arguments:\n  DEVICE                block device to install to\n\noptions:\n  -h, --help            show this help message and exit\n  --version             show program's version number and exit\n\ntext output configuration:\n  --color {never,always,auto}\n                        toggle output color (default: auto)\n  --debug               enable debugging\n  --quiet               limit output to error messages\n  --verbose             increase verbosity\n\nmachine configuration:\n  --arch ARCHITECTURE   architecture (e.g. amd64)\n  --bootloader {auto,chroot-grub2-device,chroot-grub2-drive,host-extlinux,host-grub2-device,host-grub2-drive,none}\n                        approach to take during bootloader installation\n                        (default: auto)\n  --bootloader-force    apply more force when installing bootloader (default:\n                        disabled)\n  --hostname NAME       hostname to set (default: \"machine\")\n  --openstack           prepare for use with OpenStack (default: disabled)\n  --password PASSWORD   root password to set (default: password log-in\n                        disabled)\n  --password-file FILE  file to read root password from (default: password\n                        log-in disabled)\n  --resolv-conf FILE    file to copy nameserver entries from (default:\n                        /etc/resolv.conf)\n  --disk-id ID          specific disk identifier to apply, e.g. 0x12345678\n  --first-partition-uuid UUID\n                        specific UUID to apply to first partition, e.g.\n                        c1b9d5a2-f162-11cf-9ece-0020afc76f16\n  --machine-id ID       specific machine identifier to apply, e.g.\n                        c1b9d5a2f16211cf9ece0020afc76f16\n\nscript integration:\n  --scripts-pre DIRECTORY\n                        scripts to run prior to chrooting phase, in\n                        alphabetical order\n  --scripts-chroot DIRECTORY\n                        scripts to run during chrooting phase, in alphabetical\n                        order\n  --scripts-post DIRECTORY\n                        scripts to run after chrooting phase, in alphabetical\n                        order\n\ncommand names:\n  --grub2-install COMMAND\n                        override grub2-install command\n\ngeneral configuration:\n  --cache-dir DIRECTORY\n                        directory to use for downloads (default:\n                        /var/cache/directory-bootstrap/)\n\nsubcommands (choice of distribution):\n  Run \"image-bootstrap DISTRIBUTION --help\" for details on options specific to that distribution.\n\n  DISTRIBUTION          choice of distribution, pick from:\n    arch                Arch Linux\n    debian              Debian GNU/Linux\n    gentoo              Gentoo\n    ubuntu              Ubuntu\n\n     _                          __             __      __\n    (_)_ _  ___ ____ ____  ___ / /  ___  ___  / /____ / /________ ____\n   / /  ' \\/ _ `/ _ `/ -_)/__// _ \\/ _ \\/ _ \\/ __(_-\u003c/ __/ __/ _ `/ _ \\\n  /_/_/_/_/\\_,_/\\_, /\\__/    /_.__/\\___/\\___/\\__/___/\\__/_/  \\_,_/ .__/\n               /___/                      v2.0.5 :: 2021-01-08  /_/\n\nSoftware libre licensed under AGPL v3 or later.\nBrought to you by Sebastian Pipping \u003csebastian@pipping.org\u003e.\nPlease report bugs at https://github.com/hartwork/image-bootstrap.  Thank you!\n```\n\nTo show options specific to Debian, run ..\n\n```console\n# image-bootstrap debian --help\nusage: image-bootstrap debian [-h] [--debootstrap COMMAND] [--release RELEASE]\n                              [--mirror URL] [--debootstrap-opt OPTION]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --release RELEASE     specify Debian release (default: stretch)\n  --mirror URL          specify Debian mirror to use (e.g.\n                        http://localhost:3142/debian for a local instance of\n                        apt-cacher-ng; default:\n                        http://httpredir.debian.org/debian)\n  --debootstrap-opt OPTION\n                        option to pass to debootstrap, in addition; can be\n                        passed several times; use with --debootstrap-opt=...\n                        syntax, i.e. with \"=\"\n\ncommand names:\n  --debootstrap COMMAND\n                        override debootstrap command\n```\n\n\n\u003ca name=\"Piping\"\u003e\u003c/a\u003e\n# Hints on using image-bootstrap within a pipe\n\nIf you want to run **image-bootstrap** in a pipe to capture its output to both\n`stdout`/`stderr` to a single log file, be sure to run **image-bootstrap** in\nunbuffered mode, e.g.:\n\n```console\npython3 -u image-bootstrap [OPTIONS] 2\u003e\u00261 | tee my.log\n```\n\nThe default shebang generated by python setuptools does not use `-u`. It's also\nnot easily possible to have it pass `-u` since the `env` command does allow for\nfor passing command parameters only in fairly recent versions. As a consequence,\n`stdout`/`stderr` won't be synchronized and error output you see in a log file\nwill not exactly correspond to preceding/succeeding output on `stdout`. (See\n[issue #71](https://github.com/hartwork/image-bootstrap/issues/71) for more details.)\n\nMoreover, if you're using Bash and you need to keep track of\n**image-bootstrap**'s exit code, be sure to run `set -o pipefail` prior to\ninvoking **image-bootstrap**.\n(Please see the\n[Pipelines](https://www.gnu.org/software/bash/manual/html_node/Pipelines.html)\nsection of the\n[GNU Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/index.html)\nfor more details.)\n\n\n\u003ca name=\"KnownLimitations\"\u003e\u003c/a\u003e\n# Known limitations\n\n\n\u003ca name=\"PartitionBlockTarget\"\u003e\u003c/a\u003e\n## Installing to partition block devices\n\nLinux does not like partitions in partitions much.\nIt can be tricked using device mapper, though.\n\nThis is how to install to a partition using another partition as a temporary target.\nThe temporary target must\n\n * be 2 GiB in space or more (to hold the whole distribution) and\n\n * smaller or equal than the actually target (for the later copy to work).\n\n```console\n# dmsetup create dm-linear-vda4 --table \"0 $(blockdev --getsz /dev/vda4) linear /dev/vda4 0\"\n# image-bootstrap --openstack arch /dev/mapper/dm-linear-vda4\n# partprobe /dev/mapper/dm-linear-vda4\n# pv /dev/mapper/dm-linear-vda4p1 \u003e /dev/vda2\n# dmsetup remove dm-linear-vda4p1\n# dmsetup remove dm-linear-vda4\n```\n\n(`/dev/vda2` is the real target, `/dev/vda4` the temporary one.)\n\nThere are other ways to achieve the same.\n","funding_links":[],"categories":["Python","cli"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhartwork%2Fimage-bootstrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhartwork%2Fimage-bootstrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhartwork%2Fimage-bootstrap/lists"}