I need some help figuring out how to mount partition 1 (xfs, boot) of the /dev/sda device from CentOS-7-x86_64-Minimal-1511.iso on a CentOS Linux release 7.2.1511 (Core) VM. There are multiple devices in the image. This partition is in the second device. The first device is the ISO image itself.
Some system info
$ cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
$ uname -a
Linux localhost.localdomain 3.10.0-327.3.1.el7.x86_64 #1 SMP Wed Dec 9 14:09:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ whoami
root
This is what I have done so far.
Step 1. Download and verify the ISO
$ wget http://ftp.riken.jp/Linux/centos/7.2.1511/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso
<output snipped>
$ ls -l CentOS-7-x86_64-Minimal-1511.iso
-rw-rw-r--. 1 jlinoff jlinoff 632291328 Dec 9 15:03 CentOS-7-x86_64-Minimal-1511.iso
$ md5sum CentOS-7-x86_64-Minimal-1511.iso
88c0437f0a14c6e2c94426df9d43cd67 CentOS-7-x86_64-Minimal-1511.iso
$ # matches 88c0437f0a14c6e2c94426df9d43cd67 from http://ftp.riken.jp/Linux/centos/7.2.1511/isos/x86_64/md5sum.txt
Step 2. View the available devices using parted
$ parted CentOS-7-x86_64-Minimal-1511.iso print devices
/home/jlinoff/work/iso/CentOS-7-x86_64-Minimal-1511.iso (632MB)
/dev/sda (21.5GB)
/dev/mapper/centos-swap (2147MB)
/dev/mapper/centos-root (18.8GB)
/dev/sr0 (59.0MB)
Step 3. View the partitions
$ parted CentOS-7-x86_64-Minimal-1511.iso select /dev/sda unit B print
Using /dev/sda
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 21474836480B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1048576B 525336575B 524288000B primary xfs boot
2 525336576B 21474836479B 20949499904B primary lvm
Step 4. Mount partition 1 based on the offset
$ mkdir -m 0777 /tmp/foo
$ mount -t xfs -o loop,ro,offset=1048576 CentOS-7-x86_64-Minimal-1511.iso /tmp/mnt
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
Step 5. Try to figure out the correct offset
It seemed obvious that the offset was wrong so I tried to figure it out based on the preceding filesystem by incorporating the endpoint from the previous device:
$ parted CentOS-7-x86_64-Minimal-1511.img select /home/jlinoff/work/iso/CentOS-7-x86_64-Minimal-1511.img unit B print
Using /home/jlinoff/work/iso/CentOS-7-x86_64-Minimal-1511.img
Model: (file)
Disk /home/jlinoff/work/iso/CentOS-7-x86_64-Minimal-1511.img: 632291328B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
2 196608B 6615039B 6418432B primary
$ bc
1048576 + 6615039
7663615
I tried offset=7663615 and offset=6615039. Same error.
This is the full list of all devices.
$ parted CentOS-7-x86_64-Minimal-1511.iso unit B print all
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0
has been opened read-only.
Error: /dev/sr0: unrecognised disk label
Model: (file)
Disk /home/jlinoff/work/iso/CentOS-7-x86_64-Minimal-1511.iso: 632291328B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
2 196608B 6615039B 6418432B primary
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 21474836480B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1048576B 525336575B 524288000B primary xfs boot
2 525336576B 21474836479B 20949499904B primary lvm
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/centos-swap: 2147483648B
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0B 2147483647B 2147483648B linux-swap(v1)
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/centos-root: 18756927488B
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0B 18756927487B 18756927488B xfs
What am I doing wrong?