首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何恢复iSCSI磁盘

如何恢复iSCSI磁盘
EN

Unix & Linux用户
提问于 2022-05-23 12:47:55
回答 1查看 316关注 0票数 0

我在Linux服务器(RHEL7)上运行一个RHEL7磁盘。该磁盘有一个普通的ext4分区,其中包含一个称为disk 01.img的循环设备,它被映射到一个具有Windows文件系统的虚拟磁盘上。在Windows和Linux系统之间的以太网连接中断之前,一切都很顺利。Windows决定应该检查NTFS卷,最终建议重新格式化它。在接受之前,我将文件file 01.img保存到Linux服务器上的/savedir中。我现在正在尝试恢复磁盘01.I,但我遇到了问题。

代码语言:javascript
复制
[root@server ~]# losetup -P /dev/loop1 /savedir/disk01.img
[root@server ~]# mount -t ntfs /dev/loop1 /mount/point
Failed to read bootsector (size=0)
Failed to sync device /dev/loop1: Input/output error
Failed to mount '/dev/loop1': Ongeldig argument
The device '/dev/loop1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

我想NTFS卷可能被破坏了,我需要将文件磁盘dd 01.img放到带有空NTFS分区的USB磁盘上,然后将USB磁盘移植到Windows,运行chkdsk,如果失败,尝试使用类似PhotoRec的方法恢复文件。还是我只是使用了错误的代码?

编辑: fdisk的结果(荷兰语)

代码语言:javascript
复制
[root@server ~]# fdisk -l /savedir/disk01.img

Schijf /savedir/disk01.img: 750.2 GB, 750155323392 bytes, 1465147116 sectoren
Eenheid = sectoren van 1 * 512 = 512 bytes

Sectorgrootte (logischl/fysiek): 512 bytes / 512 bytes
in-/uitvoergrootte (minimaal/optimaal): 512 bytes / 512 bytes

[root@server ~]#

编辑2: NTFS卷被损坏,所以丢失的-P正在工作,但是生成了一个空分区。我可能需要为iSCSI扇区安装/savedir/disk01.img,如

代码语言:javascript
复制
mount -o loop,offset=512 /savedir/disk01.img /mount/point

但我很难找到正确的偏移量(查找NTFS签名,将*.img文件的十六进制与新制作的虚拟磁盘的十六进制进行比较)。顺便说一句:我还将磁盘01.img的dd副本移植回Windows,试图解析这些文件。还在做这件烦琐的事。在much 01.img上查找NTFS文件系统的启动似乎是一个更好的选择。

编辑3.运行TestDisk 4次后,我似乎还无法解决几何问题。输出:

代码语言:javascript
复制
losetup -P /dev/loop1 /savedir/disk01.img
testdisk /dev/loop1

Disk /dev/loop1 - 750 GB / 698 GiB - 1465147116 sectors
... ... ...
  Linux filesys. data            0 1465147111 1465147112
  Linux filesys. data            0 1465147111 1465147112
Warning: number of heads/cylinder mismatches 255 (NTFS) != 1 (HD)
Warning: number of sectors per track mismatches 63 (NTFS) != 1 (HD)
Warning: number of heads/cylinder mismatches 255 (NTFS) != 1 (HD)
Warning: number of sectors per track mismatches 63 (NTFS) != 1 (HD)
  MS Data                100452352 1526511615 1426059264
  Linux filesys. data            0 1465147111 1465147112
... ... ...
  Linux filesys. data    730080712 2195227823 1465147112
  Linux filesys. data    730090720 2195237831 1465147112
... ... ...
  Linux filesys. data    730093536 2195240647 1465147112
  Linux filesys. data            0 1465147111 1465147112
Warning: number of heads/cylinder mismatches 255 (NTFS) != 1 (HD)
Warning: number of sectors per track mismatches 63 (NTFS) != 1 (HD)
Warning: number of heads/cylinder mismatches 255 (NTFS) != 1 (HD)
Warning: number of sectors per track mismatches 63 (NTFS) != 1 (HD)
  MS Data               1346517247 2772576510 1426059264

------------------------------------------------------

-- After Reboot --

  Linux                          0 1465147111 1465147112
  Linux                          0 1465147111 1465147112
check_FAT: can't read FAT boot sector
Invalid FAT boot sector
 0 D FAT16 LBA             3179978961 3795078107  615099147
  FAT16 LBA             3179978961 3795078107  615099147
  Linux                          0 1465147111 1465147112
Invalid FAT boot sector
 0 D FAT12                  202831329 1489073369 1286242041
  FAT12                  202831329 1489073369 1286242041
  Linux                          0 1465147111 1465147112
Invalid NTFS or exFAT boot
 0 D HPFS - NTFS           2833862451 3582746086  748883636
  HPFS - NTFS           2833862451 3582746086  748883636
Warning: number of heads/cylinder mismatches 255 (NTFS) != 1 (HD)
Warning: number of sectors per track mismatches 63 (NTFS) != 1 (HD)
Warning: number of heads/cylinder mismatches 255 (NTFS) != 1 (HD)
Warning: number of sectors per track mismatches 63 (NTFS) != 1 (HD)
  HPFS - NTFS            100452352 1526511615 1426059264


Disk /dev/loop1 - 750 GB / 698 GiB - 1465147116 sectors

The harddisk (750 GB / 698 GiB) seems too small! (< 1943 GB / 1809 GiB)
Check the harddisk size: HD jumper settings, BIOS detection...

The following partitions can't be recovered:
     Partition               Start        End    Size in sectors
>  HPFS - NTFS            100452352 1526511615 1426059264
   FAT12                  202831329 1489073369 1286242041
   Linux                  730069008 2195218167 1465149160
   Linux                  730071112 2195218223 1465147112
   Linux                  730079744 2195226855 1465147112
   Linux                  730080712 2195227823 1465147112
   Linux                  730090720 2195237831 1465147112
   Linux                  730093536 2195240647 1465147112
   HPFS - NTFS           1346517247 2772576510 1426059264
   HPFS - NTFS           1465145007 2930290014 1465145008


NTFS, blocksize=4096, 730 GB / 679 GiB

--------------------------------------

-- After adding TestDisk MBR, Reboot

  Linux                          0 1465147111 1465147112
  Linux                          0 1465147111 1465147112
  Linux                          0 1465147111 1465147112
  Linux                          0 1465147111 1465147112
check_FAT: can't read FAT boot sector
Invalid FAT boot sector
 0 D FAT16 LBA             3179978961 3795078107  615099147
  FAT16 LBA             3179978961 3795078107  615099147
  Linux                          0 1465147111 1465147112
  Linux                          0 1465147111 1465147112
Invalid FAT boot sector
 0 D FAT12                  202831329 1489073369 1286242041
  FAT12                  202831329 1489073369 1286242041
  Linux                          0 1465147111 1465147112
Invalid NTFS or exFAT boot
 0 D HPFS - NTFS           2833862451 3582746086  748883636
  HPFS - NTFS           2833862451 3582746086  748883636
Warning: number of heads/cylinder mismatches 255 (NTFS) != 1 (HD)
Warning: number of sectors per track mismatches 63 (NTFS) != 1 (HD)
Warning: number of heads/cylinder mismatches 255 (NTFS) != 1 (HD)
Warning: number of sectors per track mismatches 63 (NTFS) != 1 (HD)
  HPFS - NTFS            100452352 1526511615 1426059264

-------------------------------------

-- After Reboot, running Deeper Analysis ---

Disk /dev/loop1 - 750 GB / 698 GiB - 1465147116 sectors


  No partition          36028797018963967 1465147115 1465147117

Enter the ending sector 

--------------------------------------
EN

回答 1

Unix & Linux用户

发布于 2022-05-24 08:46:44

挂载/dev/loop1失败表明该映像文件不是有效的分区映像。由于它是用作iSCSI磁盘的映像的副本,所以我希望它是一个包含分区表的完整磁盘映像。

但是,fdisk -l /savedir/disk01.img表示不存在可识别的分区表。即使将iSCSI磁盘用作设置的一部分,也至少应该存在一个分区。

即使您有一个只识别MBR分区表的旧版本的fdisk,并且映像使用了一个GPT分区表,它至少应该已经用0xee类型的虚拟分区条目检测到了GPT的保护性MBR。

这表明分区表可能已损坏或被覆盖。您可能希望在整个磁盘循环设备上尝试testdisk,看看它是否能够找到文件系统的开始和结束,并为您重建分区表。

代码语言:javascript
复制
testdisk /dev/loop1

或者,现代版本的Windows通常将磁盘的第一个分区的开头与磁盘的开头放置1 MiB。所以你可以试着:

代码语言:javascript
复制
mount -o loop,offset=1M /savedir/disk01.img /mount/point
票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/703557

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档