====== Mount single partition from image of entire disk (device) ====== Get the partition layout of the image fdisk -lu sda.img ... Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes ... Device Boot Start End Blocks Id System sda.img1 * 56 6400000 3199972+ c W95 FAT32 (LBA) Calculate the offset from the start of the image to the partition start Sector size * Start = (in the case) 512 * 56 = 28672 Mount it on /dev/loop0 using the offset losetup -o 28672 /dev/loop0 sda.img Now the partition resides on /dev/loop0. You can fsck it, mount it etc fsck -fv /dev/loop0 mount /dev/loop0 /mnt Unmount umount /mnt losetup -d /dev/loop0 Source: [[https://askubuntu.com/questions/69363/mount-single-partition-from-image-of-entire-disk-device|External Link]] ====== Parted Use ====== ===== A partitioning scheme for UEFI GPT simpler than the one suggested by the Gentoo Handbook ===== I had always gone the BIOS MBR route and used fdisk for partitioning, but today I went for an UEFI GPT install using parted. Scary stuff! The installation handbook goes for a partitioning scheme which should work on most systems, but is unnecessary for UEFI GPT: Partition Mount point Description /dev/sda1 - BIOS boot /dev/sda2 /boot BOOT/EFI /dev/sda3 /swap swap /dev/sda4 / root fsTo be fair the handbook does mention on previous sections that two of these partitions are not necessary for UEFI GPT, but the next sections (including bootloader install) are based on this scheme, and for me personally it was a bit confusing - BIOS boot and a separate /boot which is also for EFI? What? Also, IMO going the "one size fits all" route is not the Gentoo way. So, as I wait for xorg-server to compile, here is a simpler scheme I used, along with GRUB2 installation instructions: Partition Mount point Description /dev/sda1 /boot/efi esp /dev/sda2 / root fs The same scheme is suggested on GRUB2's page on Gentoo's wiki, as I found out later. For someone used to BIOS, MBR, and fdisk, doing this with parted was a little scary, so here are the commands I used successfully in case anyone finds it useful: # Preparing the disks parted -a optimal /dev/sda mklabel gpt unit mib mkpart primary fat32 1 101 # or 257 for non-GRUB name 1 esp SWAP MISSING mkpart primary ext4 101 -1 # or 257 for non-GRUB name 2 rootfs set 1 boot quit mkfs.fat -F 32 -n efi-boot /dev/sda1 mkfs.ext4 /dev/sda2 # ... follow next handbook sections # GRUB2 install emerge sys-boot/grub:2 # Edit fstab (see example below) mkdir /boot/efi mount /boot/efi grub-install --target=x86_64-efi --efi-directory=/boot/efi grub-mkconfig -o /boot/grub/grub.cfg And my fstab with UUIDs: UUID=as_reported_by_blkid /boot/efi vfat noauto,noatime 1 2 UUID=as_reported_by_blkid / ext4 noatime 0 1 Notice this assumes your disk is /dev/sda and you're doing a full disk install. Check first! Also, always back up your data beforehand! This was done for Gentoo/Windows dual boot with the systems on physically separated disks (I physically disconnected the Windows one during install for safety).