tuxera / ntfs-3g

NTFS-3G Safe Read/Write NTFS Driver
https://www.tuxera.com/company/open-source
GNU General Public License v2.0
1k stars 149 forks source link

Support device offset to mount #47

Open kgermanov opened 2 years ago

kgermanov commented 2 years ago

Usually NTFS volume located on device at some offset. We can use losetup/mdconfig for map device from offset to another device and mount this device. But there are some problems:

  1. It is new resourse, which has limited && can be leak
  2. Method of mount is not portabled
  3. Need copy data twice: for loop device and fuse

If we pass argument for device offset we can avoid such problems.

kgermanov commented 2 years ago

@szakacsits What do you think about this?

unsound commented 2 years ago

@kgermanov Usually the offset of the NTFS filesystem is described by the partition layout. The whole device node is not mounted but instead the partition device node set up by the kernel. Can you explain in what situation you would need to mount a filesystem like this, using a raw offset?

kgermanov commented 2 years ago

@unsound This usually appears in a situation where you need to mount a dump of PhysicalDrive(not a block device)

unsound commented 2 years ago

@kgermanov In this situation I assume you would have a full sector-by-sector copy of the drive, including the partition table. So you should be able to use the -P (--partscan) option to losetup in order to get a partition device? It seems to me like a much easier option.

kgermanov commented 2 years ago

@unsound Yes, we used this. But, as I described, we faced with several problems, whose solved by this patch:

  1. It is new resourse, which has limited (256 maximum) && can be leak
  2. losetup is not portabled on FreeBSD (There is analog - mdconfig)