我曾经dd
备份80GB的驱动器
dd if=/dev/sdb of=~/sdb.img
现在,我需要访问该驱动器上的一些文件,但是我不想将“ .img”复制回该驱动器上。
mount ~/sdb.img /mnt/sdb
也不起作用。它返回:
mount: you must specify the filesystem type
我试图用找到文件系统类型 file -s
fox@shoebox $ file -s sdb.img
sdb.img: x86 boot sector; partition 1: ID=0x12, starthead 1, startsector 63, 10233342 sectors; partition 2: ID=0xc, active, starthead 0, startsector 10233405, 72517410 sectors; partition 3: ID=0xc, starthead 0, startsector 82750815, 73545570 sectors, code offset 0xc0
可以挂载sdb.img
,还是必须使用它dd
来还原驱动器?
当您使用dd
上/dev/sdb
,而不是/dev/sdb1
或者/dev/sdb2
,复制所有的分区从所述驱动到一个文件中。
您必须分别安装每个分区。
要从文件挂载分区,必须首先找出该分区在文件中的位置。
使用您的输出,file -s sdb.img
我们找到startsectors
每个分区的:
sdb.img:x86引导扇区;分区1:ID = 0×12,starthead 1,startsector 63,10233342个部门; 分区2:ID =位于0xC,活性,starthead 0,startsector 10233405,72517410个部门; 隔壁3:ID =位于0xC,starthead 0,startsector 82750815,73545570个扇区,码偏移将0xC0
分区 起始扇区
1 63
2 10233405
3 82750815
要安装单个分区,该分区X
的起始扇区在哪里,请运行:
mount ~/sdb.img /mnt/sdb -o offset=$((X*512))
因此,要挂载第二个分区,您将必须运行:
mount ~/sdb.img /mnt/sdb2 -o offset=$((10233405*512))
旁注:/mnt/sdb2
在运行之前确保存在。
玩得开心!
更新:在答案中,我认为您图像的扇区大小为512
,请参阅此问题以了解如何计算。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句