Skip to content

Instantly share code, notes, and snippets.

@parthibx24
Last active February 23, 2020 15:11
Show Gist options
  • Select an option

  • Save parthibx24/f23e3e53154ba5ef27d79bdc62c4582a to your computer and use it in GitHub Desktop.

Select an option

Save parthibx24/f23e3e53154ba5ef27d79bdc62c4582a to your computer and use it in GitHub Desktop.

Map loop device(s) from wholedisk

kpartx -av $file

dump list of partitions

LIST=/dev/mapper/loop0p*; for part in $(eval echo $LIST); do \
PARTLABEL=$(blkid $part | sed -n 's/.*PARTLABEL=\"\([^\"]*\)\".*/\1/p'); \
echo "[$part] [$PARTLABEL]"; \
dd if=$part of=/root/v21/$PARTLABEL.img status=progress; \
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment