diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index f094734..220ed3a 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -1510,21 +1510,43 @@
 	return result;
 }
 
+TWPartition* TWPartitionManager::Find_Next_Storage(string Path, string Exclude) {
+	std::vector<TWPartition*>::iterator iter = Partitions.begin();
+
+	if (!Path.empty()) {
+		string Search_Path = TWFunc::Get_Root_Path(Path);
+		for (; iter != Partitions.end(); iter++) {
+			if ((*iter)->Mount_Point == Search_Path) {
+				iter++;
+				break;
+			}
+		}
+	}
+
+	for (; iter != Partitions.end(); iter++) {
+		if ((*iter)->Is_Storage && (*iter)->Is_Present && (*iter)->Mount_Point != Exclude) {
+			return (*iter);
+		}
+	}
+
+	return NULL;
+}
+
 int TWPartitionManager::Open_Lun_File(string Partition_Path, string Lun_File) {
 	TWPartition* Part = Find_Partition_By_Path(Partition_Path);
 
 	if (Part == NULL) {
-		LOGERR("Unable to locate volume information for USB storage mode.");
+		LOGERR("Unable to locate '%s' for USB storage mode.", Partition_Path.c_str());
 		return false;
 	}
-	if (!Part->UnMount(true))
+	LOGINFO("USB mount '%s', '%s' > '%s'\n", Partition_Path.c_str(), Part->Actual_Block_Device.c_str(), Lun_File.c_str());
+	if (!Part->UnMount(true) || !Part->Is_Present)
 		return false;
 
 	if (TWFunc::write_file(Lun_File, Part->Actual_Block_Device)) {
 		LOGERR("Unable to write to ums lunfile '%s': (%s)\n", Lun_File.c_str(), strerror(errno));
 		return false;
 	}
-	property_set("sys.storage.ums_enabled", "1");
 	return true;
 }
 
@@ -1534,37 +1556,48 @@
 	string ext_path;
 	bool has_multiple_lun = false;
 
-	DataManager::GetValue(TW_HAS_DUAL_STORAGE, has_dual);
 	DataManager::GetValue(TW_HAS_DATA_MEDIA, has_data_media);
-	if (has_dual == 1 && has_data_media == 0) {
-		string Lun_File_str = CUSTOM_LUN_FILE;
-		size_t found = Lun_File_str.find("%");
-		if (found != string::npos) {
-			sprintf(lun_file, CUSTOM_LUN_FILE, 1);
-			if (TWFunc::Path_Exists(lun_file))
-				has_multiple_lun = true;
-		}
-		if (!has_multiple_lun) {
-			// Device doesn't have multiple lun files, mount current storage
-			sprintf(lun_file, CUSTOM_LUN_FILE, 0);
-			return Open_Lun_File(DataManager::GetCurrentStoragePath(), lun_file);
-		} else {
-			// Device has multiple lun files
-			sprintf(lun_file, CUSTOM_LUN_FILE, 0);
-			if (!Open_Lun_File(DataManager::GetSettingsStoragePath(), lun_file))
+	string Lun_File_str = CUSTOM_LUN_FILE;
+	size_t found = Lun_File_str.find("%");
+	if (found != string::npos) {
+		sprintf(lun_file, CUSTOM_LUN_FILE, 1);
+		if (TWFunc::Path_Exists(lun_file))
+			has_multiple_lun = true;
+	}
+	if (!has_multiple_lun) {
+		LOGINFO("Device doesn't have multiple lun files, mount current storage\n");
+		sprintf(lun_file, CUSTOM_LUN_FILE, 0);
+		if (TWFunc::Get_Root_Path(DataManager::GetCurrentStoragePath()) == "/data") {
+			TWPartition* Mount = Find_Next_Storage("", "/data");
+			if (Mount) {
+				if (!Open_Lun_File(Mount->Mount_Point, lun_file))
+					return false;
+			} else {
+				LOGERR("Unable to find storage partition to mount to USB\n");
 				return false;
-			DataManager::GetValue(TW_EXTERNAL_PATH, ext_path);
-			sprintf(lun_file, CUSTOM_LUN_FILE, 1);
-			return Open_Lun_File(ext_path, lun_file);
+			}
+		} else if (!Open_Lun_File(DataManager::GetCurrentStoragePath(), lun_file)) {
+			return false;
 		}
 	} else {
-		if (has_data_media == 0)
-			ext_path = DataManager::GetCurrentStoragePath();
-		else
-			DataManager::GetValue(TW_EXTERNAL_PATH, ext_path);
+		LOGINFO("Device has multiple lun files\n");
+		TWPartition* Mount1;
+		TWPartition* Mount2;
 		sprintf(lun_file, CUSTOM_LUN_FILE, 0);
-		return Open_Lun_File(ext_path, lun_file);
+		Mount1 = Find_Next_Storage("", "/data");
+		if (Mount1) {
+			if (!Open_Lun_File(Mount1->Mount_Point, lun_file))
+				return false;
+			Mount2 = Find_Next_Storage(Mount1->Mount_Point, "/data");
+			if (Mount2) {
+				Open_Lun_File(ext_path, lun_file);
+			}
+		} else {
+			LOGERR("Unable to find storage partition to mount to USB\n");
+			return false;
+		}
 	}
+	property_set("sys.storage.ums_enabled", "1");
 	return true;
 }
 
@@ -1576,8 +1609,6 @@
 	for (index=0; index<2; index++) {
 		sprintf(lun_file, CUSTOM_LUN_FILE, index);
 		ret = TWFunc::write_file(lun_file, str);
-		Mount_All_Storage();
-		Update_System_Details();
 		if (ret < 0) {
 			break;
 		}
diff --git a/partitions.hpp b/partitions.hpp
index bec8903..650f2f6 100644
--- a/partitions.hpp
+++ b/partitions.hpp
@@ -218,6 +218,7 @@
 	bool Backup_Partition(TWPartition* Part, string Backup_Folder, bool generate_md5, unsigned long long* img_bytes_remaining, unsigned long long* file_bytes_remaining, unsigned long *img_time, unsigned long *file_time, unsigned long long *img_bytes, unsigned long long *file_bytes);
 	bool Restore_Partition(TWPartition* Part, string Restore_Name, int partition_count);
 	void Output_Partition(TWPartition* Part);
+	TWPartition* Find_Next_Storage(string Path, string Exclude);
 	int Open_Lun_File(string Partition_Path, string Lun_File);
 
 private:
