Bug 303508

Summary: Device Notifier/Dolphin can't mount copied drive (UUID)
Product: [Frameworks and Libraries] solid Reporter: skierpage <skierpage>
Component: libsolid-udisksAssignee: Lukáš Tinkl <lukas>
Status: RESOLVED INTENTIONAL    
Severity: normal    
Priority: NOR    
Version: 4.8.3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description skierpage 2012-07-14 01:15:08 UTC
I messed up my Windows partition, so I made a backup of it to an external USB drive partition using `dd if=/dev/sdb1 of=/dev/sdg2 ...`. Later using `testdisk` with some great help from testdisk and the ntfs-3g folk I repaired them both. But now mounting the external drive through the KDE UI in Kubuntu 12.04 amd64 gives errors.  Clicking to mount the drive in Device Notifier displays "Could not mount the following device"; clicking to mount the drive in Dolphin displays
  An error occurred while accessing "WinCBackup', the system responded:
  The requested operation has failed.: Error mounting: mount exited with
  Exit code 1: helper failed with:
  mount: according to mtab, /dev/sdb1 is already mounted on
  /mnt/WindowsXPDrive
  mount failed

Well, yes indeed /dev/sdb1 is already mounted. I'm trying to mount the external drive, note it has a different label. `sudo mount /dev/sdg2 /mnt/test` works fine.

I guessed at the problem, and `solid-hardware list details` and `blkid` seem to confirm it: the two drives have the same uuid, StorageVolume.uuid = '3cc499c2c4997eb8', and
  /dev/sdb1: LABEL="Windows XP" UUID="3CC499C2C4997EB8" TYPE="ntfs"
  /dev/sdg2: LABEL="WinCBackup" UUID="3CC499C2C4997EB8" TYPE="ntfs"
So Solid or udisks thinks it's already mounted. But that seems silly, these are two different devices with different labels, different parent devices, major/minor numbers, labels, etc.

I reported this in http://forum.kde.org/viewtopic.php?f=225&t=106779 and bcooksley the System Settings and Device Actions KCM maintainer commented "it does seem plausible that someone would want to mount copies of the same image multiple times. ... Based on the error message I suspect the Solid developers may need to work with the UDisks developers to fix this."

A workaround is probably to give the external drive partition a different StorageVolume.uuid.  But there is no tool to do this for an NTFS volume, and suggestions to use dd to overwrite magic offsets in the raw partition are a little intimidating.

Reproducible: Always

Steps to Reproduce:
1. Have a built-in NTFS drive. It may be relevant that I mount it by UUID in /etc/fstab
  UUID=3CC499C2C4997EB8   /mnt/WindowsXPdrive     ntfs-3g defaults,locale=en_US.UTF-8     0       0
2. Make an exact copy of this to a partition on removable media using dd.
3. Insert the removable media and attempt to mount it using Device Notifier or Dolphin.
Actual Results:  
As above
Comment 1 Lukáš Tinkl 2012-07-23 15:23:58 UTC
I suggest reporting this to upstream udisks project; in Solid, there is no way to change the reported UUID

http://www.freedesktop.org/wiki/Software/udisks/