镜像文件怎样解压提取

得到个img文件如下:

Armbian_23.02.2_Uefi-arm64_bullseye_current_5.15.94_gnome_desktop.img: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 17276927 sectors, extended partition table (last)

看起来有partition ,通过fdisk -lu看一下这个文件

$ fdisk -lu temp.img

Disk temp.img:8.24 GiB,8845787136 字节,17276928 个扇区

单元:扇区 / 1 * 512 = 512 字节

扇区大小(逻辑/物理):512 字节 / 512 字节

I/O 大小(最小/最佳):512 字节 / 512 字节

磁盘标签类型:gpt

磁盘标识符:90ADC806-8FFE-A44B-B9AD-F15C249AE994

设备 起点 末尾 扇区 大小 类型

temp.img1 8192 532479 524288 256M EFI 系统

temp.img2 532480 17276894 16744415 8G Linux 文件系统

$sgdisk --print temp.img

Disk temp.img: 17276928 sectors, 8.2 GiB

Sector size (logical): 512 bytes

Disk identifier (GUID): 90ADC806-8FFE-A44B-B9AD-F15C249AE994

Partition table holds up to 128 entries

Main partition table begins at sector 2 and ends at sector 33

First usable sector is 2048, last usable sector is 17276894

Partitions will be aligned on 2048-sector boundaries

Total free space is 6144 sectors (3.0 MiB)

Number Start (sector) End (sector) Size Code Name

1 8192 532479 256.0 MiB EF00 efi

2 532480 17276894 8.0 GiB 8300 rootfs

用dd分解提取出来

$ name=uefi ; start=8192 ; end=532479

$ dd if=temp.img of=temp/${name}.img skip=${start} bs=512 count=$((${end} - ${start} + 1))

记录了524288+0 的读入

记录了524288+0 的写出

268435456 bytes (268 MB, 256 MiB) copied, 0.818208 s, 328 MB/s

$ ls temp

uefi.img

$ file uefi.img

uefi.img: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "mkfs.fat", Media descriptor 0xf8, sectors/track 63, heads 255, hidden sectors 8192, sectors 524286 (volumes > 32 MB), FAT (32 bit), sectors/FAT 4033, serial number 0xa7699540, label: "armbi_efi "

$ mount -t vfat, uefi.img /mnt/

ls /mnt/EFI/BOOT/BOOTAA64.EFI

/mnt/EFI/BOOT/BOOTAA64.EFI

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值