Documentation for the mounting tools module in the tools package (Tools/mount_tools.py)

This is the destination file mount tools module in the tools package for DDRescue-GUI.

class ddrescue_gui.Tools.mount_tools.Core[source]

This class contains core methods used on both Linux and macOS

classmethod mount_output_file()[source]

Mount the output file in SETTINGS[“OutputFile”].

Returns:
boolean.
True - Success False - Failed
classmethod reset()[source]

Resets the state of this class, and triggers reset of the Linux and Mac classes.

classmethod unmount_output_file()[source]

Unmount the output file.

Returns:
boolean.
True - Success False - Failed
class ddrescue_gui.Tools.mount_tools.Linux[source]

Linux-specific stuff for mounting the output file.

classmethod determine_output_file_type(output_file)[source]

Determines output File Type (partition or device).

Returns:

tuple(string, bool).

1st element: The type of the output file. “Partition”,
“Device”, “LUKS”, or “LVM”.

2nd element: True - success, False - failed.

classmethod get_volumes_luks(output_file)[source]

Gets a list of volumes on the given output file or device name. This method expects the given file or device to be a LUKS device.

Args:
output_file (str): The output file or device to get volumes for.
Returns.
list. The volumes that were found in human-readable form.
classmethod get_volumes_lvm(output_file)[source]

Gets a list of volumes on the given output file or device name. This method expects the given file or device to be an LVM Physical Volume.

Args:
output_file (str): The output file or device to get volumes for.
Returns.
list. The volumes that were found in human-readable form.
classmethod get_volumes_std_device(output_file)[source]

Gets a list of volumes on the given output file or device name. This method expects the given file or device to be a standard device.

Args:
output_file (str): The output file or device to get volumes for.
Returns.
list. The volumes that were found in human-readable form.
classmethod mount_device(output_file)[source]

Mounts the given output file or device, expecting it to be a standard device or another kind of container for volumes - LUKS or LVM.

Args:
output_file (str). The device or file to mount.
Returns:
Boolean.
True - Success False - Failure
classmethod mount_partition(partition)[source]

Mounts the given file or device name as a single volume or partition.

Args:
partition (str): The file or device to mount.
Returns:
Boolean.
True - Success False - Failed
classmethod reset()[source]

Resets the state of this class to defaults.

classmethod unmount_output_file(output_file)[source]

Unmounts the output file or device. Handles partitions, devices, LVM and LUKS disks.

Args:
output_file (str). The device or file to unmount.
Returns:
Boolean.
True - Success False - Failed
class ddrescue_gui.Tools.mount_tools.Mac[source]

Macos-specific stuff for mounting the output file.

classmethod attach_file(output_file)[source]

Attaches the given output file to the system as a read-only device.

Args:
output_file (str). The output file to attach.
Returns:
tuple. Elements:
1 - int. The return value from hdiutil attach. 2 - str. The device name of the file, or None if attaching failed.
classmethod determine_output_file_type(output_file)[source]

Determines output File Type (partition or device)..

Returns:

tuple(string, bool).

1st element: The type of the output file. “Partition”,
“Device”, “CD”, “APFSStore”, “APFSContainer” or “APFSVolume”.

2nd element: True - success, False - failed.

classmethod get_device_name(output)[source]

Get the device name of an output file, given output from hdiutil attach -plist.

Args:
output (string). Output from “hdiutil attach -plist”,
the command used to mount the output file.
Returns:

tuple(<inconsistent types>).

1st element: The device name of the output file eg
“/dev/disk5”, or None if unable to determine it.
2nd element: True (boolean) if successful in determining
device name and mount point. Otherwise, a string describing the error eg “UnicodeError”.
classmethod get_volumes_apfs(output_file)[source]

Finds volumes contained by APFS containers.

Args:
output_file (str). The output file or device to investigate.
Returns.
list. The volumes that were found in human-readable form.
classmethod get_volumes_std_device(output_file, cdimage=False)[source]

Finds volumes contained by standard devices.

Args:
output_file (str). The output file or device to investigate.
Kwargs:
cdimage[=False] (bool). Whether or not we are finding volumes on a CD device/image.
Returns.
list. The volumes that were found in human-readable form.
classmethod mount_device(output_file)[source]

Mount the given device or file. This is expected to be a standard device or other container of volumes (eg an APFS container).

Args:
output_file (str). The device or file to mount.
Returns:
Boolean.
True - Success False - Failure
classmethod mount_partition(partition, attach=False)[source]

Mounts the given partition, also attaching the file if needed.

Args:
partition (str). The partition or file to mount.
Kwargs:
attach[=False] (bool). Whether to attach the file first.
Returns:
boolean.
True - Success False - Failed
classmethod reset()[source]

Resets the state of this class to defaults.

classmethod run_hdiutil(options)[source]

Runs hdiutil on behalf of the rest of the program when called. Tries to handle and fix hdiutil errors (e.g. ‘Resource Temporarily Unavailable’) if they occur.

Args:
options (string). All of the options to pass to hdiutil.
Returns:

tuple(int, string).

1st element: The return value from hdiutil.

2nd element: The output from hdiutil.

classmethod unmount_output_file(devicename)[source]

Unmounts the given device. Can be used for output files as well, but needs to be given the device associated with them.

Args:
devicename (str). The device to unmount.
Returns:
Boolean.
True - Success False - Failed