在Debian10中挂载子分区

最近要搬家,于是把那块 Hikari 上的固态盘装到 Lolipop 上了。
后来急需一个文件,发现那块分区死都挂载不上。

原本我的硬盘 (sda) 是这么分配的:

  • /dev/sda1 Linux 系统盘
  • /dev/sda2 VM 直通盘
    • /dev/sda2p1 EFI 分区
    • /dev/sda2p2 WinOS

结果现在我只能挂载 sda,sda2p提示找不到设备。

[email protected]:/mnt/120G# mount /dev/sda2p2 ntfs
mount: /mnt/120G/ntfs: special device /dev/sda2p2 does not exist.

那么直接挂载 sda2 呢?

[email protected]:/mnt/120G# mount /dev/sda2 ntfs
mount: /mnt/120G/ntfs: wrong fs type, bad option, bad superblock on /dev/sda2, missing codepage or helper program, or other error.

emmm....
Google 上查了一下,发现有类似问题,但是没有解决方案。
google
后来到 telegram 上问了一下 dalao,解决了这个问题。

/dev/mapper

似乎这个地方是专门存放子分区文件系统的
很不巧,ls 了一下,我这边并没有相关文件。

[email protected]:/dev/mapper# ll 
总用量 0

所以,我们得手动添加

KPartx

kpartx - Create device maps from partition tables

这个软件似乎是专门来创建分区表的
Debian 默认没有带,所以得 apt 装一个
然后使用它的-a参数就可以了

[email protected]:/dev/pts# kpartx -a /dev/sda2
[email protected]:/dev/pts# fdisk -l
Disk /dev/sda: 111.8 GiB, 120034123776 bytes, 234441648 sectors
Disk model: GLOWAY VAL120GS3
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7a460d74

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048 117186559 117184512 55.9G 83 Linux
/dev/sda2       117186560 234440703 117254144 55.9G 83 Linux

Disk /dev/mapper/sda2p2: 55.6 GiB, 59665022976 bytes, 116533248 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x73736572

Device                   Boot      Start        End    Sectors   Size Id Type
/dev/mapper/sda2p2-part1      1920221984 3736432267 1816210284   866G 72 unknown
/dev/mapper/sda2p2-part2      1936028192 3889681299 1953653108 931.6G 6c unknown
/dev/mapper/sda2p2-part3               0          0          0     0B  0 Empty
/dev/mapper/sda2p2-part4        27722122   27722568        447 223.5K  0 Empty

Partition table entries are not in disk order.

出现了,sda2p2!

NTFSFix

现在还等什么?赶紧挂载把!

[email protected]:/mnt/120G/# mount /dev/mapper/sda2p2 n
The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Falling back to read-only mount because the NTFS partition is in an
unsafe state. Please resume and shutdown Windows fully (no hibernation
or fast restarting.)
Could not mount read-write, trying read-only
^C

等等等等!为什么只能挂只读了??
emm,上次没好好关 Windows 虚拟机就这样了...
直接 ntfsfix!

[email protected]:/mnt/120G/ntfs# ntfsfix /dev/mapper/sda2p2
Mounting volume... The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
FAILED
Attempting to correct errors... 
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/mapper/sda2p2 was processed successfully.

好,现在就可以了!

[email protected]:/mnt/120G# mount /dev/mapper/sda2p2 ntfs
[email protected]:/mnt/120G# cd ntfs/
[email protected]:/mnt/120G/ntfs# ll
总用量 338261
drwxrwxrwx 1 root root         0 5月  26 12:23 '$Recycle.Bin'
drwxrwxrwx 1 root root         0 5月  26 12:30  迅雷下载
-rwxrwxrwx 1 root root    427680 8月  22  2013  bootmgr
-rwxrwxrwx 1 root root         1 6月  18  2013  BOOTNXT
drwxrwxrwx 1 root root         0 5月  26 12:27  disks
lrwxrwxrwx 2 root root        20 8月  22  2013 'Documents and Settings' -> /mnt/120G/ntfs/Users
-rwxrwxrwx 1 root root 345907200 7月  15 18:19  pagefile.sys
drwxrwxrwx 1 root root         0 8月  22  2013  PerfLogs
drwxrwxrwx 1 root root      4096 7月  10 22:01  ProgramData
drwxrwxrwx 1 root root      4096 7月  14 21:49 'Program Files'
drwxrwxrwx 1 root root      4096 6月  15 22:48 'Program Files (x86)'
drwxrwxrwx 1 root root         0 5月  26 12:21  Recovery
drwxrwxrwx 1 root root         0 5月  26 12:20 'System Volume Information'
drwxrwxrwx 1 root root      4096 5月  26 12:23  Users
drwxrwxrwx 1 root root     24576 7月  10 22:07  Windows

本文链接:https://blog.ineko.cc/Mount_subpartition_in_debian.html
本博客遵循CC BY-NC-SA 3.0协议进行许可.

    ギリ猫
    ギリ猫  2020-01-31, 12:50     Android Pie /    Google Chrome

    测试

    黎明余光
    黎明余光  2020-03-11, 21:54     Windows 10 /    FireFox

    截图这个窗口阴影是怎么做到的(

      ギリ猫
      ギリ猫  2020-03-11, 22:35     Android Pie /    Google Chrome

      我邮件发给你了。
      大致就是找个白色的背景,然后手动将窗口连带阴影一起截下来