[Linux Basics] How to Share a NTFS Disk Between Windows and Ubuntu
Recently I added a new hard disk (Disk 2) on my dual-boot desktop — Windows 10 vs. Ubuntu 20.04 systems. After the new SSD was installed, I used Windows to format Disk 2 (in NTFS format) and move all my data there. My disks/partitions look like this in Ubuntu:
Problem: Ubuntu cannot create directory on Disk 2 (NTFS)
Both hard disks are available in my Ubuntu Files GUI as you can see from the screenshot, but I don’t have WRITE permissions to the Disk 2, which involves creating new folders and making change to modify the files on Disk 2.
Basics: Filesystem in Windows and Ubuntu
Windows and Linux (Ubuntu) use different types of Filesystem. Windows can have NTFS or FAT, and my Ubuntu is using ext4.
Filesystem is like an address book or a menu, which instructs the OS system on where to locate the data on disk, and this is the reason why my Ubuntu system cannot modify the partition that uses NTFS filesystem. The Disk 2 is in NTFS format, which is not native to Linux system.
Solutions: Use ntfs-3g package to mount a NTFS disk to Ubuntu system
The solution is simple. We will use a package that can auto mount this NTFS device to a Ubuntu path even after your system is reboot.
First, we would need to install a package called ‘ntfs-3g’. This is a read/write NTFS driver for Linux system.
sudo apt-get update
sudo apt install ntfs-3g
Then, create a path of your choice on Ubuntu system.
mkdir /media/myname/data
Lastly, mount the partition (in NTFS format) to the Ubuntu path. (Note: You would have to change your partition name. My partition is /dev/nvme0n1p2)
sudo mount -t auto /dev/nvme0n1p2 /media/myname/data
Note: If your partition was already mounted, umount it first.
sudo umount /dev/nvme0n1p2
Trouble shoot: If you encounter “Failed to mount ‘/dev/nvme0n1p2’: Input/Output Error” use ntfsfix to fix. ntfsfix is part of ntfs-3g package and it can fix some of the common NTFS issues.
sudo ntfsfix /dev/nvme0n1p2
More: How to find the partition/device name and its filesystem type?
Use fdisk to check:
sudo fdisk -l
It will print out all the available disk names and the partitions on it. I know the new hard disk is a Samsung SSD, so I would look for the model name and the partitions underneath it (which has /dev/nvme0n1p1 and /dev/nvme0n1p2), and the second one has the right Size so it is what I am looking for.
If you can see the disk from your Ubuntu File GUI, the partition name is also there.
Finished! Now your Ubuntu system has successfully mounted the NTFS partition/disk, and this parition can be used from both Windows and Ubuntu on your dual-boot machine.
If you like this tutorial, please leave a thumb up or a comment. Your encouragement is what keeps me moving! Thanks for reading!