Sunday, May 7, 2017

Mounting Logical Volume Management (LVM) Volumes

I have two hard drives from an old Linux machine. These hard drives were under one Logical Volume Management volume. On another Linux host, I found these tools were very useful to get the data out.

  • Scan LVM volumes

    sudo lvscan

  • Activate LVM volumes

    modprobe dm-mod
    vgchange -ay

  • List and remove mapped LVM devices

    dmsetup ls
    dmsetup remove <device>

    where an example of "device" can be VolGroup00-LogVol01

Troubleshooting

When you see an error message like the following when you try to mount a volume,


# mount /dev/VolGroup00/LogVol00 mnt/
  mount: /dev/mapper/VolGroup00-LogVol00 is write-protected, mounting read-only
  mount: /dev/mapper/VolGroup00-LogVol00: can't read superblock

One solution that has worked for me many times is to remove the mapped LVM devices using the command we discussed in the above. For instance,

# dmsetup remove VolGroup00-LogVol00

If you perform a lvscan, you will find that the volume is inactive,

# lvscan
  inactive          '/dev/VolGroup00/LogVol00' [459.53 GiB] inherit

To activate the volume, we can run the following

vgchange -ay

Now you shall see that the volume is active,

# lvscan
  ACTIVE            '/dev/VolGroup00/LogVol00' [459.53 GiB] inherit

We can now mount the volume,

# mount /dev/VolGroup00/LogVol00 mnt/


Thursday, May 4, 2017

Windows Explorer Appears to Get Stuck at Canceling Copying Files

When I tried to cancel copying a large set of files at a Windows 10 system, it appears that Windows got stuck at canceling it forever. Below I saw,

which shows this "Canceling - 10% complete" indicator forever even after I closed the window. When I tried to copy a different file, this indicator stayed. This is actually not that the Windows tried to cancel copying forever. It is instead that Windows Explorer somehow kept some internal canceling state.

At present, the solution to address this are a few. The following two appear to work.
  • Reboot the system. This is a heavy-handed solution.
  • Terminate the Windows Explorer process, and restart the Windows Explorer process.

Monday, May 1, 2017

Finding Encrypted Files or Folders on Windows NTFS Partitions

Windows NTFS supports Windows Encrypting File System (EFS),which means some files or folders can be encrypted. In more than one occasion, I have lost access to files or folders while I copied them to external hard drives. Perhaps, one strategy is to list files or folders that are encrypted, and we can then decide what to do with them. This can be easily achieved on Windows Command Prompt via the following command,

cipher /S:D:\ /H | findstr "^E"

In the above example, we are looking for encrypted files on drive D:\. Command cipher lists all files and folders, and indicates whether the files or the folders are encrypted. The switch /H is to instruct cipher to look for hidden or system files as well. Command findstr allows us to use Regular Expression, and In "^E", "^" indicates the beginning of a line and "E" indicates that the file or the folder is encrypted.

Resetting Windows NTFS Ownership and Permission to Default

I moved an external hard drive from from one computer to another, and discovered that I could not access to any of the folders. The file system is NTFS. As suggested by this post, I completed the following steps to set all folders to the Windows default from Windows Command Prompt as an Administrator, and regained access to the files.

takeown /F D: /R /D
icacls "_Files" /reset /T 

The first command above is to take the ownership. The noticeable effect of the second command is to assign full access to everyone.