mkfs.fat -F32 /dev/loop0p1
mkfs.fat -F32 /dev/loop0p2
mkfs.ntfs /dev/loop0p3
The partition start sector was not specified for /dev/loop0p3 and it could not be obtained automatically. It has been set to 0.
The number of sectors per track was not specified for /dev/loop0p3 and it could not be obtained automatically. It has been set to 0.
The number of heads was not specified for /dev/loop0p3 and it could not be obtained automatically. It has been set to 0.
Cluster size has been automatically set to 4096 bytes.
To boot from a device, Windows needs the 'partition start sector', the 'sectors per track' and the 'number of heads' to be set.
Windows will not be able to boot from this device.
Initializing device with zeroes: 100% - Done.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
它起作用了
parted /dev/loop0 p
Model: Loopback device (loopback)
Disk /dev/loop0: 315MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 41,9MB 40,9MB primary fat32 lba
2 83,9MB 168MB 83,9MB primary fat32
3 168MB 315MB 147MB primary ntfs
系统中没有ddrescue,请安装它
apt install gddrescue
制作磁盘映像
ddrescue /dev/loop0 image.img mapfile
GNU ddrescue 1.23
Press Ctrl-C to interrupt
ipos: 314507 kB, non-trimmed: 0 B, current rate: 139 MB/s
opos: 314507 kB, non-scraped: 0 B, average rate: 104 MB/s
non-tried: 0 B, bad-sector: 0 B, error rate: 0 B/s
rescued: 314572 kB, bad areas: 0, run time: 2s
pct rescued: 100.00%, read errors: 0, remaining time: n/a
time since last successful read: n/a
Finished
现在有一个磁盘镜像image.img删除loop0
losetup -d /dev/loop0
删除原始图像disk.img(我们有image.img的副本)
rm disk.img
ls -l
итого 307204
-rw-r--r-- 1 root root 314572800 ноя 17 03:00 image.img
losetup -f -P --show ./image.img
lsblk /dev/loop0
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 300M 0 loop
├─loop0p1 259:6 0 39M 0 part
├─loop0p2 259:7 0 80M 0 part
└─loop0p3 259:8 0 140M 0 part
mount /dev/loop0p3 /mnt
lsblk /dev/loop0
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 300M 0 loop
├─loop0p1 259:6 0 39M 0 part
├─loop0p2 259:7 0 80M 0 part
└─loop0p3 259:8 0 140M 0 part /mnt
处理图像
左右
--find将强制 losetup 查找第一个空闲循环设备。--partscan然后将读取映像,识别分区,并以分区表中的偏移量创建代表它们的相应文件。 --show将输出这个
接下来挂载需要的分区
为了检查一下,让我们制作一个图像
创建空磁盘的镜像,例如300M它起作用了
将空图像上传到循环设备
你可以看到可用的循环
我们有可用的loop0,并将使用它。
创建分区表
创建三个部分
创建文件系统
它起作用了
系统中没有ddrescue,请安装它
制作磁盘映像
现在有一个磁盘镜像image.img删除loop0
删除原始图像disk.img(我们有image.img的副本)