Using ldmtool to mount NTFS dynamic mirror: Difference between revisions
Created page with "How to do a read-only automatic fstab mount of an NTFS dynamic mirrored volume in Linux: ==== Add ldm service to automatically create /dev/mapper for dynamic volumes ==== sudo vim /etc/systemd/system/ldm.service [Unit] Description=ldmtool After=network.target [Service] Type=forking User=root ExecStart=/usr/bin/ldmtool create all Restart=on-failure [Install] WantedBy=multi-user.target Now you need to reboot systemctl reboot ==== Automatic mounting ====..." |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 29: | Line 29: | ||
sudo mkdir /var/mnt/whatever | sudo mkdir /var/mnt/whatever | ||
Add to /etc/fstab to mount readonly | Add to /etc/fstab to mount readonly | ||
sudo vim /etc/fstab | |||
/dev/disk/by-id/dm-uuid-LDM-Volume1-LDM_UUID_GOES_HERE /var/mnt/whatever ntfs defaults,ro,nofail 0 0 | /dev/disk/by-id/dm-uuid-LDM-Volume1-LDM_UUID_GOES_HERE /var/mnt/whatever ntfs defaults,ro,nofail 0 0 | ||
Test mount to make sure it's valid | Test mount to make sure it's valid | ||
| Line 49: | Line 51: | ||
However, if ldmtool doesn't run for some reason, the UUID link of the NTFS UUID instead points at one of the volume subparts. This would result in Linux trying to mount that subpart instead, which might result in corruption of the array. Using the LDM volume ID as documented above is much safer and results in the mount silently failing if ldmtool fails to run rather than the volume potentially being corrupted. | However, if ldmtool doesn't run for some reason, the UUID link of the NTFS UUID instead points at one of the volume subparts. This would result in Linux trying to mount that subpart instead, which might result in corruption of the array. Using the LDM volume ID as documented above is much safer and results in the mount silently failing if ldmtool fails to run rather than the volume potentially being corrupted. | ||
==== Known issues ==== | |||
* Dolphin shows unmount icon against LDM volumes for some reason (not sure how to fix this) | |||
Latest revision as of 17:03, 8 February 2026
How to do a read-only automatic fstab mount of an NTFS dynamic mirrored volume in Linux:
Add ldm service to automatically create /dev/mapper for dynamic volumes
sudo vim /etc/systemd/system/ldm.service
[Unit] Description=ldmtool After=network.target [Service] Type=forking User=root ExecStart=/usr/bin/ldmtool create all Restart=on-failure [Install] WantedBy=multi-user.target
Now you need to reboot
systemctl reboot
Automatic mounting
Find the UUID of the dynamic volume using ldmtool
sudo ldmtool scan
Find the dev mapper ID of the volume, it should be dm-uuid-LDM-Volume1-LDM_UUID_GOES_HERE, where the UUID should be the same as the one we already identified, might as well double check though
cd /dev/disk/by-id/ ls -alF
Create mount directory
sudo mkdir /var/mnt/whatever
Add to /etc/fstab to mount readonly
sudo vim /etc/fstab
/dev/disk/by-id/dm-uuid-LDM-Volume1-LDM_UUID_GOES_HERE /var/mnt/whatever ntfs defaults,ro,nofail 0 0
Test mount to make sure it's valid
sudo mount -a
If it's valid then it should be remounted upon reboot due to fstab entry
Stop the subportions of the array from appearing in udisks drive list
If you don't do this then the volume subparts get listed in any program that asks udisks for a list of disks. Dolphin, LibreOffice, possibly other tools. Clicking them tries to mount the individual volume subportion which is undesired and might cause corruption of the array. It seems safer to create a udev rule which blocks the subparts from appearing in the udisks drive list, so they don't appear on the GUI anywhere.
Find the UUID of the NTFS volume using lsblk
lsblk -f
Create hide partition udev rules file, replace the IDs as appropriate
sudo vim /etc/udev/rules.d/99-hide-partitions.rules
SUBSYSTEM=="block", ENV{ID_FS_UUID}=="NTFS_UUID_GOES_HERE", ENV{UDISKS_IGNORE}="1"
SUBSYSTEM=="block", ENV{DM_UUID}=="LDM-Volume1-LDM_UUID_GOES_HERE", ENV{UDISKS_IGNORE}="0"
Important: do not add volume into fstab by NTFS UUID
If ldmtool does run, the UUID of the NTFS volume is pointed at the ldm /dev/mapper/ which works, so sometimes people do this.
However, if ldmtool doesn't run for some reason, the UUID link of the NTFS UUID instead points at one of the volume subparts. This would result in Linux trying to mount that subpart instead, which might result in corruption of the array. Using the LDM volume ID as documented above is much safer and results in the mount silently failing if ldmtool fails to run rather than the volume potentially being corrupted.
Known issues
- Dolphin shows unmount icon against LDM volumes for some reason (not sure how to fix this)