问题:
使用
qemu-img
创建的磁盘文件,直接使用
mount
挂载到本地,然后修改里面的关配置文件
解决方法:
1. 查看磁盘文件信息
# fdisk -lu T-MXW-centos.raw
…………………
Units = sectors of 1 * 512 = 512 bytes
……….
Device Boot Start End Blocks Id System
T-MXW-centos.raw1 * 63 208844 104391 83 Linux
T-MXW-centos.raw2 208845 12787739 6289447+ 82 Linux swap / Solaris
T-MXW-centos.raw3 12787740 62910539 25061400 83 Linux
Partition 3 has different physical/logical endings:
phys=(1023, 254, 63) logical=(3915, 254, 63)
2. 如同上面,raw1是boot分区,raw3是根分区;
如果需要挂载根分区的话,需要设置mount的偏移量,offset为12787740*512
# mount -o loop,offset=$((12787740*512)) T-MXW-centos.raw /mnt
3. end ,测试
# ls /mnt
bin boot data dev etc halt home lib lib64 lost+found media misc mnt net opt proc root sbin selinux srv sys tftpb
转载于:https://blog.51cto.com/fifeapple/1064099