To create an offsite backup, I plugged an external hard drive via USB to my home NAS server. The external hdd has one partition and is formatted with NTFS (to allow create some backups from Windows hosts, too).
I mounted the partition to /mnt2 and wanted to sync the data from NAS, but it failed:
# rsync -rtuP /mnt/data/Movies/ /mnt2/Movies/
sending incremental file list
1,956,669,762 100% 108.73MB/s 0:00:17 (xfr#1, to-chk=1040/1042)
436,338,688 20% 104.03MB/s 0:00:16 ^C
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(638) [sender=3.1.1]
rsync: mkstemp "/mnt2/Movies/.Test1.mp4.mwuEtR" failed: Permission denied (13)
rsync: mkstemp "/mnt2/Movies/.Test2.mp4.ialsVx" failed: Permission denied (13)
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at io.c(504) [generator=3.1.1]
Permissions were correct, at least that root was able to write:
# ls -l /mnt2
drwx------ 1 root root 0 Jan 2 2018 Family
drwsr-sr-x 1 root root 232K Oct 14 20:00 Movies
drwx------ 1 root root 24K Dec 30 2017 Movies-Kids
drwx------ 1 root root 0 May 6 2017 Pictures
But when I tried to manually create a file, permission denied again:
# touch /mnt2/bla
touch: cannot touch ‘bla’: Permission denied
I checked dmesg and saw the following:
[12867539.697380] ntfs: (device sde1): ntfs_setattr(): Changes in user/group/mode are not supported yet, ignoring.
[12867539.697386] ntfs: (device sde1): ntfs_setattr(): Changes in user/group/mode are not supported yet, ignoring.
[12867539.697392] ntfs: (device sde1): ntfs_setattr(): Changes in user/group/mode are not supported yet, ignoring.
I checked how the partition was mounted:
# mount | grep sde1
/dev/sde1 on /mnt2 type ntfs (rw,relatime,uid=0,gid=0,fmask=0177,dmask=077,nls=utf8,errors=continue,mft_zone_multiplier=1)
"rw is there so it should work", would be my first guess. But I remembered that NTFS mounts are a little bit special on Linux.
In order to "really" mount a NTFS drive and write on it, one needs the ntfs-3g package, which uses fuse in the background.
Note: I wrote a similar article but for MAC OS X back in 2011: How to read and write an NTFS external disk on a MAC OS X.
I installed the package which installed fuse as a dependency:
# apt-get install ntfs-3g
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
The following NEW packages will be installed:
Now I just needed to unmount the external hdd and mount it with ntfs-3g:
# mount -t ntfs-3g /dev/sde1 /mnt2
Checking mount again, the partition is now mounted as type fuseblk:
# mount | grep sde1
/dev/sde1 on /mnt2 type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
And voilà, I can now write to the NTFS partition:
# touch /mnt2/bla && stat /mnt2/bla
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 841h/2113d Inode: 16406 Links: 1
Access: (0777/-rwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-10-18 20:29:45.914775500 +0200
Modify: 2018-10-18 20:29:45.914775500 +0200
Change: 2018-10-18 20:29:45.914775500 +0200
No comments yet.
Personal Internet VMware PHP Linux Shell Bluecoat Proxy Windows Hardware Virtualization Nagios MySQL DB Monitoring Mail Android Network Wyse Hacks Tomcat Postgres Apple Mac Backup BSD ZFS Solaris SmartOS Unix Multimedia Perl Database MongoDB CMS OTRS FreeBSD Wordpress LXC Nginx Proxmox DNS Graphics GlusterFS Security Chef HAProxy Icinga Ansible HTML MariaDB Containers Rancher Docker AWS ELK Kibana Logstash Filebeat Varnish PGSQL PostgreSQL ElasticSearch CouchDB Bash Macintosh Container Minio Grafana InfluxDB Databases NFS OSSEC SystemD Java Zoneminder Surveillance Elasticsearch SSL TLS Icingaweb2 Cloud Wireless Kubernetes Ubuntu