Virtualize disk with minimal space: Difference between revisions
Jump to navigation
Jump to search
Created page with "* Clean things up * Boot from separate media e.g. boot-repair live iso, shrink partition to desired size with gparted * On other system connect disk, check partition layout w..." |
No edit summary |
||
| Line 1: | Line 1: | ||
* Clean things up | * Clean things up | ||
* Boot from separate media e.g. boot-repair live iso, shrink partition to desired size with gparted | * Boot from separate media e.g. boot-repair live iso, shrink partition to desired size with gparted | ||
* On other system connect disk, check partition layout with fdisk -l, dd if=source of=file bs=[Units in fdisk] count=[end of last partition +1 to cover last +33 for backup gpt table] (https://serverfault.com/a/853753 https://forums.raspberrypi.com/viewtopic.php?t=288670#p1745543) | * On other system connect disk, check partition layout with fdisk -l, dd if=source of=file bs=[Units in fdisk] count=[end of last partition +1 to cover last +33 for backup gpt table if gpt] (https://serverfault.com/a/853753 https://forums.raspberrypi.com/viewtopic.php?t=288670#p1745543) | ||
* Boot from separate media with image attached, gparted likely will show unpartitioned | * Boot from separate media with image attached, gparted likely will show unpartitioned | ||
* | * If GPT disk: use sgdisk -e /dev/disk to recreate backup gpt partition table at end of disk (https://askubuntu.com/a/1370440) | ||
* If wanting to make a sparse qcow2 image: | |||
** Mount image, fill empty space with zeroes with dd if=/dev/zero of=tmpfile, rm tmpfile | |||
** qemu-img convert -f raw -O qcow2 -S 4k [source] [dest] | |||
Latest revision as of 10:44, 8 August 2022
- Clean things up
- Boot from separate media e.g. boot-repair live iso, shrink partition to desired size with gparted
- On other system connect disk, check partition layout with fdisk -l, dd if=source of=file bs=[Units in fdisk] count=[end of last partition +1 to cover last +33 for backup gpt table if gpt] (https://serverfault.com/a/853753 https://forums.raspberrypi.com/viewtopic.php?t=288670#p1745543)
- Boot from separate media with image attached, gparted likely will show unpartitioned
- If GPT disk: use sgdisk -e /dev/disk to recreate backup gpt partition table at end of disk (https://askubuntu.com/a/1370440)
- If wanting to make a sparse qcow2 image:
- Mount image, fill empty space with zeroes with dd if=/dev/zero of=tmpfile, rm tmpfile
- qemu-img convert -f raw -O qcow2 -S 4k [source] [dest]