Tuesday, January 27, 2015

Mounting NTFS as Read-only

Mounting a Hibernated Windows NTFS File System as Read-Only in Linux

Picture of Tux
Tux
I have a laptop computer with a hard-disk that is partitioned in such a way that it can be booted by three different operating systems.

All the operating systems can share the same data.

The OS are:

  • Windows 7
  • Ubuntu 12.10
  • and, Kubuntu 12.10


So, I have many operating systems installed on the same machine.

I can choose to boot from anyone of them.

Sometimes, I hibernate Windows 7 and I reboot my computer with Ubuntu.

Once in Ubuntu, I want to access files on the Windows 7 partition from Ubuntu. But if Windows was hibernated (instead of shutdown), it is not wise to mount the Windows NTFS file system and then to make changes to it. If you try to mount the Windows NTFS file system using the ntfs-3g command, you will get an error message anyway.  But if you want just to access (i.e. read) files, you can still mount the NTFS file system as "read-only" to get the files without messing up the Windows NTFS volume.

Here is how to do that if the Windows partition you want to access is for example located on /dev/sda2 and you want to mount it into the directory /mnt/sda2 :

Become root:
% su

Execute the following mount command:
# mount -t ntfs-3g -o ro /dev/sda2 /mnt/sda2

After that, the files of your NTFS Windows file system will be accessible (as read-only) on the specified mount point (/mnt/sda2 in this example).

Super Tip About the Mount Command

You can mount a file system (or another directory) into any directory, even in a directory already containing files.
The files of the mounted directory will replace temporarily, and logically, the ones into the mount point.
The original files will reappear when you will unmount (detach) the mounted directory.

No comments:

Post a Comment