我有 5 个磁盘分区,这些分区来自单独映像的磁盘,但没有映像分区表。我该如何将它们重新组合成一个连贯的磁盘映像?

我有 5 个磁盘分区,这些分区来自单独映像的磁盘,但没有映像分区表。我该如何将它们重新组合成一个连贯的磁盘映像?

正如标题所述,我有 5 个磁盘映像,,,,,dev-sdc1.img。我没有保存分区表,也不知道哪些是主分区等。它最初来自具有 GUID 分区表的 Windows PC dev-sdc2.imgdev-sdc3.imgdev-sdc4.imgdev-sdc5.img

我如何将它们拼接成一个具有有效分区表的分区映像,然后将其复制回与原始分区大小相同的驱动器上? 我可以接受主/逻辑部分与原始部分不一样。

我将使用 Lubuntu 或 Ubuntu Mate 以及任何适用于 Linux 的工具。

编辑:人们问为什么,这原本是一台 Windows 笔记本电脑,我决定在上面安装另一个操作系统,并单独备份分区。我不确定某些分区的用途(不记得这是出厂时安装的 Win 10 还是手动安装的),所以我将它们全部备份以便以后查看数据。后来我改变了主意,不再使用其他操作系统,因为我最终需要一台 Windows 机器,所以我试图重新安装 Windows。但是,我第一次尝试通过创建分区表并将gparted映像复制到磁盘上来手动将所有分区复制dd到磁盘上,但未能启动。

询问的命令的输出:

cat@borg:~/drive-images-laptop$ file -kr dev-sdc1.img 
dev-sdc1.img: DOS/MBR boot sector, code offset 0x52+2, OEM-ID "NTFS    ", sectors/cluster 8, Media descriptor 0xf8, sectors/track 63, heads 255, hidden sectors 2048, dos < 4.0 BootSector (0x80), FAT (1Y bit by descriptor); NTFS, sectors/track 63, sectors 1021951, $MFT start cluster 42581, $MFTMirror start cluster 2, bytes/RecordSegment 2^(-1*246), clusters/index block 1, serial number 02260c83d60c81a05; contains bootstrap BOOTMGR
- DOS/MBR boot sector
-  DOS/MBR boot sector DOS executable (COM), boot code
- data
cat@borg:~/drive-images-laptop$ file -kr dev-sdc2.img 
dev-sdc2.img: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "MSDOS5.0", sectors/cluster 2, reserved sectors 6670, Media descriptor 0xf8, sectors/track 63, heads 255, hidden sectors 1024000, sectors 202752 (volumes > 32 MB), FAT (32 bit), sectors/FAT 761, serial number 0x1ac90d22, unlabeled
- DOS/MBR boot sector
-  DOS/MBR boot sector DOS executable (COM), boot code
- data
cat@borg:~/drive-images-laptop$ file -kr dev-sdc3.img 
dev-sdc3.img: data
cat@borg:~/drive-images-laptop$ file -kr dev-sdc4.img 
dev-sdc4.img: DOS/MBR boot sector, code offset 0x52+2, OEM-ID "NTFS    ", sectors/cluster 8, Media descriptor 0xf8, sectors/track 63, heads 255, hidden sectors 1259520, dos < 4.0 BootSector (0x80), FAT (1Y bit by descriptor); NTFS, sectors/track 63, sectors 466447340, $MFT start cluster 786432, $MFTMirror start cluster 2, bytes/RecordSegment 2^(-1*246), clusters/index block 1, serial number 07afc98edfc98a543; contains bootstrap BOOTMGR
- DOS/MBR boot sector
-  DOS/MBR boot sector DOS executable (COM), boot code
- data
cat@borg:~/drive-images-laptop$ file -kr dev-sdc5.img 
dev-sdc5.img: DOS/MBR boot sector, code offset 0x52+2, OEM-ID "NTFS    ", sectors/cluster 8, Media descriptor 0xf8, sectors/track 63, heads 255, hidden sectors 467707904, dos < 4.0 BootSector (0x80), FAT (1Y bit by descriptor); NTFS, sectors/track 63, sectors 1150975, $MFT start cluster 47957, $MFTMirror start cluster 2, bytes/RecordSegment 2^(-1*246), clusters/index block 1, serial number 0e82a64152a63ded6; contains bootstrap BOOTMGR
- DOS/MBR boot sector
-  DOS/MBR boot sector DOS executable (COM), boot code
- data
cat@borg:~/drive-images-laptop$ wc -c dev-sdc1.img 
523239424 dev-sdc1.img
cat@borg:~/drive-images-laptop$ wc -c dev-sdc2.img 
103809024 dev-sdc2.img
cat@borg:~/drive-images-laptop$ wc -c dev-sdc3.img 
16777216 dev-sdc3.img
cat@borg:~/drive-images-laptop$ wc -c dev-sdc4.img 
238821038592 dev-sdc4.img
cat@borg:~/drive-images-laptop$ wc -c dev-sdc5.img 
589299712 dev-sdc5.img

Kamil Maciorowski 的附加输出,我从 4 的输出中删除了一些包含私有数据的文件名,但没有删除其他文件名:

cat@borg:~/drive-images-laptop$ sudo sh -c 'for i in 1 2 4 5; do echo "$i"; mount -o ro "dev-sdc$i.img" /mnt && { ls /mnt; umount /mnt; } done'
1
 Recovery  'System Volume Information'
2
 EFI  'System Volume Information'
4
'$Recycle.Bin'                  Cygwin-files             'Programs Self-contained'
'$WinREAgent'                   Dashcam-2023              logfile.log                      Recovery
'2023-08-12 Phone backup'          'Documents and Settings'       pics-misc                    room-pics
 2023-08-vids-room              DumpStack.log             pagefile.sys                     shared
 Backup-2022-06-12              DumpStack.log.tmp         PerfLogs                     swapfile.sys
'BBC Spaghetti-Harvest in Ticino.mp4'   From-3DS-card-backup-2023-03-25   posting                     'System Volume Information'
 bootmgr                    gp-doc                ProgramData                      Users
 BOOTNXT                    hiberfil.sys             'Program Files'                   Windows
 cygwin64                   Intel                'Program Files (x86)'                 youtube.txt
5
 Recovery  'System Volume Information'
cat@borg:~/drive-images-laptop$ 

答案1

在目标磁盘上手动创建(使用fdisk或类似工具)一个新的分区表,其分区大小与分区映像相同,然后将dd分区映像放到适当的分区上。

相关内容