9

I'm having some doubts about how to install and allow Linux to correctly read/write to a NTFS formatted harddrive used as backup of various machines (windows included, that's how I need NTFS).

For now, I've read some pages and I have the feeling I need someone else's guidance from who already did this step-by-step, to not ruin things here.

What I need is to be able to save a Linux file, with its chown and chmod settings, to a NTFS filesystem, and be able to retrieve this information back.

What I have today is a NTFS that saves all files with the owner:group of who mounted the volume, and permissions rwxrwxrwx for all.

I read this article but it is too much information and I could not understand some things when trying to actually implement:

  • Is it stable in the current version?
  • Does Ubuntu 10.04 have all things needed already? Or do I need to install anything?
  • What is the relation of POSIX ACL to this? Do I need install anything regarding this or just ntfs-3g will do?
  • Where are Ubuntu packages to run with apt-get?
  • If I map the users (with usermap) can bring the harddrive to another computer with different users, will I be able to read them? (Under Linux/Windows)?

For one thing I noticed, usermap was not ready to use. So I downloaded and compiled (but not installed because I was afraid to mess up things here), the latest version of ntfs-3g. In the README file it says:

> TESTING WITHOUT INSTALLING
> 
> Newer versions of ntfs-3g can be
> tested without installing anything and
> without disturbing an existing
> installation. Just configure and make
> as shown previously. This will create
> the scripts ntfs-3g and lowntfs-3g in
> the src directory, which you may
> activate for testing :
> 
>         ./configure
>         make
> 
>   then, as root :
>         src/ntfs-3g [-o mount-options] /dev/sda1 /mnt/windows
> 
>   And, to end the test, unmount the
> usual way :
>         umount /dev/sda1

But it tells nothing about the mount-options that I need to use to have full backups (full == backing up / restoring files, owners, groups and permissions).

This faq says:

Why have chmod and chown no effect?

By default files on NTFS are owned by root with full access to everyone. To get standard per-file protection you should mount with the "permissions" option. Moreover, if you want the permissions to be interoperable with a specific Windows configuration, you have to map the users.

Also, I did used the ntfs-3g.usermap /dev/sdb2 tools to create the map file and got this result:

# Generated by usermap for Linux, v 1.1.4
:carl:S-1-5-21-889330461-3416208041-4118870141-511
:default:S-1-5-21-2592120051-4195220491-4132615201-511
carl:carl:S-1-5-21-889330462-3416208046-4118870148-1000

Now this default was mapped because I wrote "default" to one file that was under the default user during the inquiring. I'm not sure if I did that right. I don't care for any users but carl (and root for that matter), and for any other groups but users. I saw the FAQ telling me to answer the group with the username. Isn't it the case to tell the group as "users"? And how can I check, booting Windows, if this mapping is correct?

Summary:

  1. I need rsync to save Linux files and Windows files from various computers, to a NTFS external USB HD, without losing file permissions.
  2. I don't know how to install and run the driver ntfs-3g to allow chown, chmod and anything else that is needed to make that possible. What options, and where?
  3. All computers have carl username, but that doesn't guarantee that their SID, UID or GID are the same.
  4. The environment is composed of 18 "documents" folders, 6 of them Linux, 6 of them Win7, 6 of them virtualbox Win XP. All of them will be a single "documents" folder into the NTFS external hard drive.

Reference:

  • I also read this forum, and maybe it is useful to someone trying to help me here.
  • Also thought of these other three solutions, making the filesystem ext. But the external HD may be used in Windows boxes; I could not install or have write to install drivers, so it needs to be readable easily by any Windows and NTFS is the standard.

All my Google searches was too much technical to follow.

2
  • 3
    This is not a tutorial-on-demand site, it is a QnA site. You should probably break this down into several questions and take it step by step. Also I think your summary is probably verbose enough to grasp the whole problem without all the other details. The less people have to work to understand what you are asking the more likely they are to jot down an answer.
    – Caleb
    Apr 21, 2011 at 7:43
  • see also a similar question/goal: unix.stackexchange.com/questions/31022/… Jul 3, 2013 at 18:51

1 Answer 1

11

You can use ntfs-3g, but make sure you place the mappings file in the right place. Once you do that you should see file ownerships in ../User/name match the unix user.

However, if you just want to use it as backup you should probably just save a big tarball onto the ntfs location. If you also want random access you can place an ext2 image file and loop mount it. That will save you from a lot of these headaches.

Ok, assuming you will mount NTFS under /ntfs

run ntfs-3g.usermap /dev/sdb1 (or whatever your ntfs partition is). Answer the questions. Then mkdir /ntfs/.NTFS-3G. Then cp UserMapping /ntfs/.NTFS-3G/UserMapping. Now put an entry in /etc/fstab:

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

Then mount /ntfs. The command ls -l /ntfs/Users/Carl should show your Linux user as the owner of files there.

11
  • Thanks Keith, but just "you can use ntfs-3g" will actually not help too much. You say it is stable, so I can use it without concerns? That is good. One doubt down. But now: how to do it is the question! :) About the ext2 image file, I can't mount it under windows, so that is not possible. Also, I can't create a tarball under windows without installing software. The backup is not only from linux to HD, but also from windows to HD.
    – DrBeco
    Apr 21, 2011 at 7:47
  • @caleb I don't have the conditions to create tarballs under windows without installing some "tar" file. Remember, I'm not using only linux, but booting linux and windows, bringing the external USB HD with me, some places saving info, other places just using the info. I would use info also in computers that is not even mine, like for presentation, class teaching, etc. So, I need plain NTFS. Thanks
    – DrBeco
    Apr 21, 2011 at 7:49
  • @Drbeco hm, I use ntfs-3g and haven't had any problems with it (once I figured out the mappings file). I guess it's still not clear to me what you are trying to do. Do you also need Windows to access your Linux backup files?
    – Keith
    Apr 21, 2011 at 7:51
  • 2
    They are just files, I would not categorize them as being linux files or windows files. They are my projects, source codes (portable codes that compile and run in both SO), presentations, etc. So, yes, I need them to be available under both SO. Kind of trick, isn't it? What I don't know is how to enable linux to use correclty NTFS.
    – DrBeco
    Apr 21, 2011 at 7:53
  • 1
    I've used NTFS-3g extensively and under heavy load with zero problems. I've even been able to delete files which for one reason or another could not be deleted from within Windows.As for using an EXT2 image, you can access EXT2 filesystems from Windows using Ext2 IFS (warning: EXT2 and EXT3 only, not EXT4!). Apr 21, 2011 at 8:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .