pkoutoupis / rapiddisk

An Advanced Linux RAM Drive and Caching kernel modules. Dynamically allocate RAM as block devices. Use them as stand alone drives or even map them as caching nodes to slower local disk drives. Access those volumes locally or export them across an NVMe Target network. Manage it all from a web API.
http://www.rapiddisk.org
GNU General Public License v2.0
296 stars 49 forks source link

Does rapiddisk support exFAT filesystem? #160

Closed mhtvsSFrpHdE closed 1 year ago

mhtvsSFrpHdE commented 1 year ago

Formatted use either Windows format.exe and Linux gparted

sudo modprobe dm-writecache
sudo rapiddisk -a 2000
sudo rapiddisk -m rd0 -b /dev/nvme0n1p7 -p wb
mkdir ~/ramdisk
sudo mount /dev/mapper/rc-wb_nvme0n1p7 ~/ramdisk

and get these when mount

[  319.654196] exFAT-fs (dm-0): logical sector size too small for device (logical sector size = 512)
[  319.654203] exFAT-fs (dm-0): failed to read boot sector
[  319.654204] exFAT-fs (dm-0): failed to recognize exfat type

If formatted to ext4, the issue is gone.
But I'm interested to access this drive on Windows natively.

pkoutoupis commented 1 year ago

@mhtvsSFrpHdE What are your formatting options for exfat so I can try to recreate your scenario?

mhtvsSFrpHdE commented 1 year ago

@mhtvsSFrpHdE What are your formatting options for exfat so I can try to recreate your scenario?

gparted default format option, dnf install gparted or version 1.4.0

Another is just dual boot to Windows 11 22H2 then format D: /fs:exfat

pkoutoupis commented 1 year ago

OK. I will try to run through this exercise over the weekend. But just a few things to note:

  1. This error is coming from the file system (exFAT) and not rapiddisk-cache.
  2. RapidDisk-Cache does not cache anything that is smaller than or a multiple of a standard page (e.g. 4K). So, if the filesystem's logical block size or the write requests are 512, 1K or 2K bytes (ext4 is default 4K) and not 4K or a multiple of, it will never take advantage of the caching component.
  3. Maybe I am thinking of this the other way around: it is exFAT that is having an issue with the device's logical sector size and needs to be 4K. What happens when you don't map the NVMe drive with rapiddisk and just mount it? Also note that rapiddisk-cache currently does not support 4K logical block sizes for the underlying backing store device: https://github.com/pkoutoupis/rapiddisk/issues/59.
mhtvsSFrpHdE commented 1 year ago

@pkoutoupis
Not a very critical issue for me right now because I use kernel 6.1.12-200.fc37 which is come with NTFS support so I'm using NTFS to do cross device access.

For 3.
I'm sorry, I didn't realize that issue is exist with title "4K Logical Drives",
My attention is all drawn to exfat.

In my mind, I seem to mount it successfully and viewed file content with ls command for once,
before combine it with rapiddisk. I can't recall the details, and now I formatted it to NTFS.
I do a test here:

mhtvsSFrpHdE commented 1 year ago

To create ramdisk on a NVME SSD seems funny because they are already fast.
No, what I'm doing is try to reduce total write to nand.

Read once, write x terabytes who knows, and dm-writecache flush 2GB to disk, unmount.

pkoutoupis commented 1 year ago

Oh, I overlooked that detail. I didn't realize that you are using writeback. OK, that relies on a different module: dm_writecache and not rapiddisk-cache. Anyway, thank you for the details. I will let you know what I find out this weekend.

pkoutoupis commented 1 year ago

OK. I was able to reproduce. So, I haven't dived too deep into it but it looks as if there is a block alignment issue introduced by dm_writecache. My underlying device which is a 512 logical block size is formatted with exfat and it expects to find the boot sector, superblock, etc at certain regions BUT dm_writecache changed the logical block size to 4096 (or 4K) and after the mapping, it fails to mount. The only way around that so far, is to format the dm_writecache mapping and THEN mount:

petros@ubuntudevvm:~/rapiddisk/src$ sudo mkfs.exfat -n TEST /dev/mapper/rc-wb_loop5 
exfatprogs version : 1.1.3
Creating exFAT filesystem(/dev/mapper/rc-wb_loop5, cluster size=32768)

Writing volume boot record: done
Writing backup volume boot record: done
Fat table creation: done
Allocation bitmap creation: done
Upcase table creation: done
Writing root directory entry: done
Synchronizing...

exFAT format complete!
petros@ubuntudevvm:~/rapiddisk/src$ sudo mount /dev/mapper/rc-wb_loop5 /mnt/
petros@ubuntudevvm:~/rapiddisk/src$ df -t exfat
Filesystem              1K-blocks  Used Available Use% Mounted on
/dev/mapper/rc-wb_loop5    522240    96    522144   1% /mnt

Unfortunately, I cannot change the dm_writecache logical block size. It is an upstream driver not maintained by the RapidDisk project and also, the 4K setting may play an integral part to the way it works.

mhtvsSFrpHdE commented 1 year ago

Thank you for the information! I continue to stick with my NTFS configuration then.
NTFS file system with write back works fine

pkoutoupis commented 1 year ago

Sounds good. I will just close this comment then and if you feel the need to reopen or open a new one, do not hesitate. Thank you.