Here are the steps to be done in order to transfer files
from a Linux filesystem (JFS/XFS/Reiserfs/EXT3/whatever you prefer)
to a Windows filesystem (NTFS).
The NTFS support
in Linux-2.6 is very limited
(because Microsoft doesn't disclose the technical bits about how NTFS works).
Specifically, it does not
support these operations:
- Creating/deleting files
- Growing/shrinking files
It only allows writing over existing files.
For this reason, you have to use Windows to create an image you'll write over.
Say, you're going to copy 5 gigabytes of files to your NTFS partition.
You must create a 5 gigabyte file to your NTFS partition, using your Widows.
In Linux (or any unix system in general), you would do it with a
dd if=/dev/zero bs=1m count=5000 of=file
command, but in Windows, it's not that simple.
You can create it in any way you want ― the contents of the file
do not matter. If you can't think of anything, I recommend
to compress a couple of
anime episodes together.
When you have created the big file, rename it as something.tar.gz
Ensure the filename ends with .tar.gz
(dot tee ay ar dot jee zed
The file may be bigger than the source files together,
but it must not be smaller.
For some reason, the evil corporation
has made it sure that it's approximately impossible
to write a filesystem driver for Windows.
They don't want to support other systems.
They want everyone to use Windows, Windows, Windows.
If your subject is an EXT2 / EXT3 filesystem, you can
for a shareware Windows program
that lets you read those filesystems in Windows. For the other
ones mentioned, there's no such choice.
So, ironically, in order to mount a JFS/XFS/Reiserfs/whatever
filesystem to copy files to Windows, you must boot into Linux.
In order to boot into Linux, you need to have Linux installed somewhere.
I won't cover Linux installation & starting in this document ― I'll
just assume you have it somewhere. If you're lazy and lucky, a non-permanent
Linux installation such as a "livecd" is probably enough.
Testing NTFS write support
Prerequirement for understanding the rest of this document:
ability to use a terminal (xterm, aterm, gnome-terminal, console,
whatever you prefer).
The tricky part is that your NTFS driver in Linux must have been
compiled with WRITE SUPPORT -- otherwise it won't write anything.
Try mounting your NTFS partition (remember to be root!):
mount /dev/hda5 -t ntfs /mnt/d -o rw
with your partition location.
If the mount command fails and you didn't type anything wrong,
you don't have NTFS support at all.
Do a modprobe ntfs
and try again. If it still fails, you
need to compile the NTFS driver. See below.
If the mount command worked without problem, next do this:
grep /dev/hda5 /proc/mounts
If the line you get contains "rw,
", you can skip the following
chapter and read about how to write.
If the line contains "ro,
", mount cheated you; there is no NTFS
write support in your kernel. You need to rebuild the driver.
If the line doesn't contain either of those, you probably
did something wrong or your /proc
filesystem is not mounted
or it is something that I can't diagnose within one sentence.
Compiling the NTFS driver
You need to get the kernel source and configure it. I don't detail
the instructions on how to do that (because it's impossible for me
to cover all different distributions and preferences).
- If you use NTFS as a module, you need to handle the same version of kernel source as is the kernel you're currently running (type uname -r to see it).
- If you use a "livecd", you might experience great obstacles in attempting to affect its configuration.
When you're in the menuconfig (make menuconfig
- go to File systems -> DOS/FAT/NT Filesystems
- ensure there's a M or a * in NTFS filesystem support
- ensure there's a * in the NTFS write support
Then exit, exit, exit and answer Yes
to the "do you want to save" question.
Recompile your kernel (you should know how) and install the modules.
If you compiled NTFS as a non-module, you need to reboot now.
After done, unload the old NTFS driver:
If it complains it's busy, unmount all NTFS mounts (umount -a -t ntfs
and try again.
Then load the new NTFS driver:
Now go back to the mounting test.
At this point:
- you have verified that your kernel has NTFS write support
- you have mounted the target filesystem
- the target filesystem contains a file to copy over
Mount the source filesystem (or have it already mounted), and proceed:
For the sake of clarity, we'll use now these assumptions. Adjust the
instructions in your mind if these are not exactly your cases:
- The files we're copying are: /mnt/b1/anime/FMA/*.avi
- The 5 GB file in NTFS filesystem we're writing into is: /mnt/d/Animet/FMA.tar.gz
Use this command:
tar cvfz - *.avi | dd conv=notrunc of=/mnt/d/Animet/FMA.tar.gz
This should work. Did you get error messages?
Sorry, I can't help you there. You'll have to resolve it yourself.
So what happened?
- We created a .tar.gz archive and passed it to the standard dd program which wrote it into the NTFS file.
Note that using dd
, and specifically its conv=notrunc
is important here. The normal '<
' and '>
' ways of redirecting
the stream don't work, because NTFS writes rely on the file size
Now reboot to Windows.
Verify the filesystem
As the first thing, run a filesystem check on the NTFS filesystem. Ensure it's not broken.
(It shouldn't be, but it's better to be certain than sorry.)
Open the archive
After you have verified the filesystem, go and open the .tar.gz
(the one you created in the beginning of these instructions) with your
favourite archiver program (such as WinRAR).
After you have decompressed it, you may safely delete it.
Page created by Joel Yliluoma
E-mail address: 0bihTjsqJewwiErt@g0likCZ3i.tCfi
Thanks to Paul Jackson for the conv=notrunc