Mount windows disk on linux

Windows drives aren’t mounted automatically when you log in on Linux. But that doesn’t mean you can’t access those NTFS drives at all.

inside of a hard disk

If you are rocking a dual-boot setup with Windows and Linux, you might want to access data stored in the Windows drives from the Linux system.

However, you might find that Windows drives do not appear in the file manager. This is because, in some distros, you need to manually mount them. Let’s take a look at how you can access your NTFS/Windows drives in Linux.

Step 1: Install the NTFS-3G Driver

To successfully mount and access NTFS drives on Linux, you will need to install a driver to ensure no incompatibility issues arise. The go-to driver when working with NTFS drives is NTFS-3G. It’s cross-compatible between Debian/Ubuntu derivatives, Arch Linux-based systems as well as RHEL/CentOS/Fedora systems.

To install the NTFS-3G driver on your Linux system, fire up a terminal and install it using the package manager of the distro that you’re running:

On Debian and Ubuntu, run:

 sudo apt install ntfs-3g 

On Arch-based systems, run:

 sudo pacman -S ntfs-3g 

To install the NTFS-3G driver on Fedora, CentOS, or RHEL, issue the following command:

 sudo dnf install ntfs-3g 

This should install the driver on your Linux system. Now you can move on to the next steps.

Step 2: Identify the NTFS Partition

output of the fdisk -l command

A preliminary step before mounting a drive is to first identify its device ID. This is important because you might end up causing unwanted data loss by working with the wrong partition or drive.

To identify all the drives and their partition types, use the fdisk command with the -l flag.

 sudo fdisk -l 

The output will display all the different drives and partitions along with useful information like size, available free space, partition type, and more. Take note of the device name carefully. You will be needing it later on in this guide.

Step 3: Make a Directory to Mount the Drive

In Linux, everything is treated as a file, including hardware devices. So, to mount your NTFS drives on Linux, you have to create a separate directory wherein the drive will be mounted, and its content laid out.

This process is as simple as creating a regular directory on Linux. Using the mkdir command, create a new directory in the root partition of your Linux system. For the sake of better organization, make the directory under the /mnt directory and name it «media».

 sudo mkdir /mnt/media 

Now that we’ve allocated a directory for the NTFS drive, we need to update the file system tables on Linux with the location of the drive.

Step 4: Update the File System Tables and Mount the Drive

update fstab

Updating the file system tables is a crucial step that enables your Linux machine to recognize and mount new storage drives. In Linux, the /etc/fstab file stores the file system configurations.

 sudo nano /etc/fstab

You need to add the NTFS drive’s location and other important data to make sure that your system can mount it without any hiccups.

To update the file system table of your Linux system, use any text editor of your choice and open the /etc/fstab file.

In a new line, add the NTFS drive location, the directory that you created earlier, the driver to use (NTFS-3g), and read, write, and user access information. Make sure to separate each input with one Tab space. If you’re unsure what to type in, you can replicate the settings for any drive that’s already mounted and functional.

Write out the file once you’re done inputting the data. Fire up the terminal and use the mount command in conjunction with your device ID to mount it:

 mount /dev/sda3 /mnt/media/drive_location_here

In case you wish to unmount the drive, you can do that using the umount command:

 umount /dev/sda3 /mnt/media/drive_location_here 

That’s all you need to do. Optionally you can restart your system, however, it won’t be required in most cases. You can now explore your NTFS drive from the terminal using the cd command or via the file manager of your Linux distro.

Now You Can Access Windows Drives in Linux

While it may be a bit tedious, it is still straightforward and a permanent process. You can now freely mount and unmount your Windows drives when logged into Linux. In case you want to permanently use the drive on Linux, you will need to format it.

Search code, repositories, users, issues, pull requests…

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Mounting_Error

Figure: Error occurred while accessing the windows drive

Following are the step wise instructions to access windows drives in Ubuntu (Any Version),

1. Open terminal and type sudo ntfsfix error mounting location as shown in above picture and press enter button.
2. It will ask for system password, enter password and again press enter.
3. It will take some seconds to process command and at the end shows the message like “NTFS partition was processed successfully.”
4. Again click on windows drive, now you are allow to access clicked drive.

For Example:
Step 1:

Type sudo ntfsfix /dev/sda3 and press enter as shown in below picture then it will ask for system password, enter password and again press enter.

Step 2:
It will take some seconds to process command and at the end shows the message like “NTFS partition was processed successfully”, as shown in below picture.

Last Updated :
23 Dec, 2018

Like Article

Save Article

The New Technology File System (NTFS) is a proprietary file system created by Microsoft and is used extensively in Microsoft’s Windows operating systems.

By default most Linux distributions are not able to mount NTFS, however it is possible to install a driver that allows us to do this so that we can read and write data to an NTFS disk.

In this example I have attached the VMDK file from a Windows based virtual machine to a CentOS 7 Linux virtual machine.

When we run ‘fdisk -l’ we can see that the disk is recognized (after a system reboot), however it is not yet mounted for us to access the data. We can see the primary disk for the Linux system /dev/sda, while /dev/sdb is our 1GB NTFS disk which has the /dev/sdb1 NTFS partition.

[root@centos7 ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0004c930

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      616447      307200   83  Linux
/dev/sda2          616448     4810751     2097152   82  Linux swap / Solaris
/dev/sda3         4810752    41943039    18566144   83  Linux

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xfc757b2a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             128     2091135     1045504    7  HPFS/NTFS/exFAT

By default when I try to mount the NTFS disk, we get the below error.

[root@centos7 ~]# mkdir /windows
[root@centos7 ~]# mount /dev/sdb1 /windows/
mount: unknown filesystem type 'ntfs'

Install Required Packages

In order to perform the mount, we need to install the ntfs-3g package, which is a Linux NTFS userspace driver. This package comes from EPEL if you’re using CentOS/RHEL, so if you have not yet configured your system to use the EPEL repository, run the following command.

[root@centos7 ~]# yum install epel-release -y

Now we should be able to install the ntfs-3g package from the EPEL repository.

[root@centos7 ~]# yum install ntfs-3g -y

Otherwise if you’re using Ubuntu/Debian, you should just be able to run ‘apt-get install ntfs-3g’ straight away. In my Debian 8 installation it was already available so I was able to mount NTFS without any problems.

Mount The NTFS Disk

We can now successfully perform the mount without any errors.

[root@centos7 ~]# mount /dev/sdb1 /windows/

[root@centos7 ~]# blkid /dev/sdb1
/dev/sdb1: LABEL="NTFS" UUID="CA4A1FD94A1FC0DD" TYPE="ntfs"

We can confirm that the NTFS disk is now seen as mounted by the operating system.

[root@localhost ~]# df -h /windows/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1      1021M   11M 1011M   2% /windows

At this point you should be able to read and write data on the mounted NTFS disk.

Automatically Mount NTFS

We can create an entry in the /etc/fstab file so that our NTFS disk will automatically mount on system boot. Below is an example of the entry that I have placed into my fstab file. This will mount the disk to the /ntfs directory.

/dev/sdb1       /windows        ntfs-3g defaults        0 0

Once this configuration has been added, the NTFS disk should mount automatically on system boot. Before performing a reboot, it is recommended to first run the ‘mount -a’ command and confirm that the disk mounts without errors. If there are errors that happen during boot, you may be left with a system that does not properly boot so it’s important to test first.

Summary

We have seen that it is possible to easily mount an NTFS disk in CentOS 7 Linux once the ntfs-3g package has been installed which provides us with the necessary drivers.

Если у вас на компьютере установлены две операционные системы: Linux и Windows 8, 8.1 или 10 и вы захотите примонтировать системный раздел Windows, чтобы скопировать оттуда или записать туда файлы, то, скорее всего, столкнетесь с ошибкой.

В современных системах такие разделы монтируются в режиме только для чтения по умолчанию, но если вам надо туда что-то записать, то придется немного поработать. В этой статье мы поговорим о том как подключить диск Windows в Linux.

Скорее всего, если вы попытаетесь примонтировать раздел Windows, утилита mount выдаст вот такое сообщение: Error mounting: windows is hibernated refused to mount и примонтирует его только для чтения:

Это связано с использованием в новых версиях Windows алгоритма гибридной загрузки с использованием гибернации, которая и мешает вам получить доступ к вашим файлам.

Такое сообщение может сбить вас с толку. Обычно мы выключаем компьютер, с помощью пункта Завершение работы в меню Пуск. Никаких упоминаний о гибернации там нет, но Linux утверждает система находиться в режиме гибернации. А дело в том, что современные версии Windows используют гибернацию по умолчанию для ускорения загрузки.

Когда вы выключаете современную операционную систему Windows, она выключается не полностью, часть системных процессов сохраняются на диск, чтобы загрузка выполнялась быстрее. Это ускоряет процесс загрузки, но и имеет недостаток при использовании Linux.

Чтобы исправить эту проблему можно загрузить Windows и отключить гибридную загрузку. Единственным недостатком такого метода будет замедление загрузки системы. Она будет загружаться приблизительно с такой же скоростью, как Windows 7. Но зато вы сможете выполнить подключение раздела Windows в Linux. Ещё можно войти в Windows и перезагрузить компьютер, при выборе этой опции гибернация не используется.

1. Перезагрузка Windows

Windows не использует гибридную загрузку во время перезагрузки. Если выбрать пункт перезагрузка, то сохраненное начальное состояние будет стерто и создано новое.

Поэтому если в следующий раз захотите перейти в систему Linux из Windows — выбирайте пункт перезагрузка. Так система не уйдет в гибернацию и у вас не возникнет ошибок во время монтирования раздела Windows в Linux.

2. Выключение с клавишей Shift

Если вам нужно именно выключить компьютер есть еще один способ. Когда выбираете пункт меню выключить удерживайте нажатой клавишу Shift. Тогда система тоже не будет использовать гибернацию и полностью выключиться.

3. Отключение гибридной загрузки

Если вы не хотите думать какую кнопку нажимать и что делать при каждой перезагрузке Windows, можно полностью отключить гибридную загрузку. Но тогда Windows будет загружаться медленнее. Это также может понадобиться если аппаратное обеспечение компьютера не поддерживает гибридную загрузку. После ее отключения вы сможете легко выполнять монтирование разделов Windows в Linux без каких-либо ошибок в режиме как для чтения так и для записи.

Для этого загрузитесь в Windows, откройте панель управления, откройте пункт Оборудование и звук. В разделе Электропитание  выберите Изменение параметров, которые сейчас недоступны:

В открывшимся окне кликните по ссылке Изменить параметры, которые сейчас недоступны, затем пролистайте вниз и снимите галочку с пункта Включить быстрый запуск:

Затем нажмите кнопку Сохранить изменения.

4. Удаление файла Hiberfile.sys утилитой диски

Вместо перенастройки Windows, можно автоматически удалять файл гибернации каждый раз когда вам нужно выполнить монтирование разделов Windows в Linux. Конечно, после такой процедуры система будет загружаться медленнее, но потом она снова создаст файлы гибридной загрузки и продолжит использовать быстрый запуск. Это идеальный вариант если вы нечасто пользуетесь системным разделом Windows и не хотите терять скорость загрузки.

Но имейте в виду, что если вы действительно отправите компьютер в режим гибернации оставив открытыми программы и не сохраненные данные, то Linux все равно удалит реальный файл гибернации вместе со всеми вашими данными. Разницу между видами гибернации определить невозможно.

Для удаления файла hiberfile.sys достаточно добавить опцию монтирования файловой системы ntfs remove_hiberfile. Этот же совет вы можете видеть когда пытаетесь монтировать системный раздел с помощью ntfs3g.

В Ubuntu и других дистрибутивах с оболочкой Gnome это можно сделать с помощью утилиты Диски:

В правой части окна программы выберите жесткий диск с Windows, затем выберите системный раздел Windows. Кликните по кнопке с шестерней и выберите Изменить параметры подключения:

Переключите выключатель Automatic Mount Options в положение Off, затем вставьте следующую строку в конец опций монтирования внизу окна:

,remove_hiberfile

Нажмите OK и введите свой пароль. Теперь можете попробовать примонтировать системный раздел Windows в файловом менеджере Nautilus. Как видите, монтирование выполняется успешно, без каких-либо ошибок. Если файл гибернации был включен система его попросту удалит.

5. Удаление файла hiberfile.sys утилитой mount

Если вам нужно просто один раз подключить Windows раздел в Linux, несмотря на ошибку error mounting windows is hibernated и не настраивая никаких автоматических опций воспользуйтесь утилитой mount. Команде нужно передать имя системного раздела Windows включить ту же самую опцию, например:

mount -o defaults,rw,remove_hiberfile -t ntfs /dev/sda2 /mnt/ntfs

Здесь /dev/sda2 — раздел диска с Windows, а /mnt/ntfs — точка монтирования.

Эти действия необходимы, только если вам нужен доступ для записи файлов на системный раздел Windows. Если же вам просто нужно просмотреть или скопировать тот или иной файл можно выполнить монтирование разделов windows в Linux в режиме только для чтения. Например:

mount -o defaults,ro -t ntfs /dev/sda1 /mnt/ntfs

В Linux можно монтировать системные разделы в режиме только чтение, даже когда система Windows в гибернации.

Выводы

Независимо от того какой способ вы выбрали, в результате вы должны получить возможность подключить раздел Windows для чтения и записи:

Использование нескольких систем на одном компьютере — очень часто практикуется новичками. Обмен файлами между двумя системами — нормальное явление, а поэтому вы очень часто будете сталкиваться с этой ошибкой. Но эта статья поможет вам решить ее раз и навсегда. Если остались вопросы, пишите в комментариях!

Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.

  • Mouse without borders windows 11
  • Mount shared windows folder linux
  • Modem device on high definition audio bus скачать драйвер windows 10
  • Mount linux drive in windows
  • Mmdevapi audioendpoints driver windows 10