LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   howto: copy files/folder(entire directory) from linux harddrive to ntfs formatted dri (https://www.linuxquestions.org/questions/linux-newbie-8/howto-copy-files-folder-entire-directory-from-linux-harddrive-to-ntfs-formatted-dri-4175432723/)

stevenvw 10-17-2012 12:39 PM

howto: copy files/folder(entire directory) from linux harddrive to ntfs formatted dri
 
Hello,

I have a harddrive that is formatted with a linux partition (the partition was my data partition). However, the main harddrive on the computer died...I want to copy my data onto a harddrive that is formatted with ntfs so that I can place this in a windows machine instead. I am using a live disc right now, but I cannot copy and paste all the folders/files over because of permission issues, so it seems that I will need to use the terminal to do this...but im not exactly sure how to go about doing this..

I have three harddrives connected to the computer running the live disc, and I would like to copy all the files/folders from my linux formatted disc(sda) to the ntfs disk(sdc)
It would also maybe be a good idea to reformat sdc (with ntfs of course) to make sure that there are no extra partitions/folders/files before copying the directory of sda??

the linux hd is "sda"
and the destination disc is "sdc"


any help is appreciated,
thanks

JaseP 10-17-2012 01:08 PM

To get around permission issues, you need to be root (using either sudo or su)... when transferring the files.

If you want to use the data again within Linux, you would want to stay on a Linux filesystem. It it doesn't matter, it would be safer to move to a FAT32 partition (assuming the files don't exceed 4GB each). Using Linux to format and write a large number of files to NTFS is a potentially risky proposition (NTFS support in Linux is reverse engineered).

If you have a home network, and another machine, you might want to install a new Linux OS (or boot with a Live CD that supports Samba), share the Linux partition or drive you want to export the data from, and copy the files over the network to the Windows machine...

I, for one, don't trust Linux's ability to manipulate NTFS in anything resembling a stable way, any more than I would trust Windows to write EXT4 partitions (with the proper 3rd party drivers)...

It begs the questions,... What kind of data is it? How large are the files? And,... Where do you intend to use it?

stevenvw 10-17-2012 04:09 PM

ok, first: I don't plan to keep using the data in windows...this computer was pretty much being used for file storage (over the network). This was the only linux machine that was being used, the data was all from windows computers

second: I plugged in the 'data' hard-drive from the Linux machine with the ext4? partition(sda) as well as an spare blank drive(sdc) into another computer that I have (running Ubuntu live-disc right now) If its a little shaky with ntfs I have no issue with going to fat32 (i just want to copy all the files/folders onto a partition that is natively recognized in windows) because of permissions issues I cannot copy and paste these folders without being root, so I am stuck using the terminal and sudo

the data is mainly financial information and documents, pictures etc, so the 4GB file size should not be an issue


I am a complete noob when it comes to Linux and using the terminal, so I would need step-by-step instructions to ever be able to do this...:/ The only thing that I was able to figure out was which computer was sda/sdb/sdc (and thats about all I know..)

hua 10-17-2012 05:35 PM

You are going to need to find out the partitioning of your hard-drive (sdc). The default ntfs mounted disk doesn't allow you to write. You need to mount it with ntfs-3g. These means:
Quote:

root@server:/# df -hT
Filesystem Size Used Avail Use% Mounted on
/dev/root 33G 28G 2.9G 91% /
/dev/sda2 19G 12G 5.6G 68% /home
/dev/sdc1 10G 2G 8G 20% /ntfs-disk
tmpfs 492M 0 492M 0% /dev/shm
This will list the mounted devices. Umount your device and mount it back with ntfs-3g.
Quote:

umount /ntfs-disk
mount -t ntfs-3g /dev/sdc1 /ntfs-disk
You should be able to write now.

stevenvw 10-19-2012 02:53 PM

formatted to fat32
 
Ok, to make life a little easier I just took the ntfs disk, popped it into a windows machine and reformatted the entire disk as fat32

so now all I need to do is simply copy the files over on the disc with fat32...each disc has only one partition on it also which should help keep life a little simpler as well..

So now I'm ready to copy the data over, but I'm not sure which commands to use anymore...would you be able to tell me exactly what has to be typed in (including where to type sude etc...sorry, I feel really stupid right now, and I just want to make sure that I am doing this right
thanks

Habitual 10-19-2012 05:44 PM

Code:

cd ~
rsync -avzp . /ntfs-disk

should copy your /home/$user directory contents over to /ntfs-disk

Code:

man rsync

Fred Caro 10-19-2012 06:57 PM

#1
stevenvw,
copy the stuff to a fat (32/16etc) partition on anything handy and put that on your ntfs partition/disk as I don't think fat recognises permissions. Alternatively change the permissions on the original with chmod eg, 'chmod 777 /dev/whatevever'

Fred.


All times are GMT -5. The time now is 03:37 AM.