LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   How to copy directories (https://www.linuxquestions.org/questions/debian-26/how-to-copy-directories-609732/)

sofasurfer 12-28-2007 11:09 PM

How to copy directories
 
I am trying to copy my home folder to my Windows partition for safe keeping and so I can back it up along with Windows. So far I'm having no luck.

I created a folder in my Windows c: directory into which I want to put my /home directory.

My most recent command goes something like this...

daryl@24-236-143-115:~$ cp -ir /home /mnt/windows/linux
bash: /$: No such file or directory

fuzzyworm 12-28-2007 11:18 PM

There doesn't seem to be anything obviously wrong with the command. Just out of interest, though, could you just type in exactly the command that you typed, without any of the other information, as the error message looks a bit suspect for what appears to be a perfectly legit command.

Also:

What format is the windows partition?
Linux doesn't natively support writing to NTFS drives. This is deliberate, as it avoids losses in journalling data.

Have you checked the case of the folder name - windows may have added a capital letter, which makes no difference in windows, but in Linux, /mnt/windows/linux and /mnt/windows/Linux are two different folders.

Also, you might want to try getting the Windows ext3fs drivers. You might find it easier to do from within windows. There are some free ones around, and some commercial ones. Depending on the importance of the data, it might be worth making sure you get one that fully supports ext3 and journalling.

Hope this is of some help.

sofasurfer 12-28-2007 11:38 PM

24-236-143-115:/home/daryl# cp -r /home /mnt/windows/linux
cp: cannot create directory `/mnt/windows/linux/home': Operation not permitted

If I have it right, the syntax is cp -r /source /destination

Case is correct.
I do have Windows formated in NTFS. Is this possibly the problem or definatly the problem?

What is Windows ext3fs drivers for?

The other day I passed by a program to access Linux file system from within Windows. I didn't think it was important at the time. Do you know what that was?

kzutter 12-29-2007 12:04 AM

Quote:

Originally Posted by sofasurfer (Post 3004500)
I do have Windows formated in NTFS. Is this possibly the problem or definatly the problem?

Definitely a problem.

Quote:

Originally Posted by sofasurfer (Post 3004500)
What is Windows ext3fs drivers for?

The other day I passed by a program to access Linux file system from within Windows. I didn't think it was important at the time. Do you know what that was?

That is what he means by ext3fs drivers. This will allow you read (e.g. copy) your files from Windows. (However, it requires that your Linux partition is formatted ext2 or ext3)

jschiwal 12-29-2007 12:54 AM

If you modprobe the fuse module and install the ntfs-3g package, you will be able to mount your windows partition in read-write mode. Because of the different permissions that are used by windows, you should use tar to backup your home directory, and then you can backup the tar file when you backup windows. This will also allow incremental backups.

fuzzyworm 12-29-2007 04:46 AM

Yeah, Linux won't (by default) allow you to write to an NTFS drive. The safest way to get around this problem, if you have the disk space, is to create a new partition and format it as FAT32, which is writeable to both Linux and Windows.

If you can't, then either enable NTFS writing in Linux (It was disabled for a reason) or ext2 (assuming yours is ext2/ext3) writing in Windows. Note that for the same reason (i.e. the journal) ext3 support in Windows should be approached with care.

My advice would be to either do the FAT32 partition option, or use a Linux backup solution - there are plenty out there.

sofasurfer 12-30-2007 09:12 PM

I've never seen an option in Linux to enable or disable NTFS writing. Please explain.

As for your suggestions regarding fat32, they bring up a related but differant subject...

Originally my system WAS fat32 but I converted it to ntfs and I read that if I did this I would be stuck with the ntfs since it was not possible to convert back to fat32. However, I assumed that if I ever wanted to I could reformat as a fat32 and reinstall windows.

Now, onto my current situation...

In order to solve my problem of not being able to write to the windows ntfs from Linux, I reinstalled windowsxp using another hard drive. I attempted to create a fat32 system. The only software I have to format my drives with , and it has always worked well for me, is "PC Beginner System Analyzer.
I wiped the drive clean and the chose to format it. It gave me the choice of NTFS or fat or fat32. I chose fat32but it would not do anything. So I chose fat. I reinstalled windowsxp (don't know weather it was in fat 16 or fat32. Next I reinstalled Debian along side it. And when I got to the Grub part it warned that windows may not be on the menu. Sure enough, when I rebooted, windowsxp was not on the menu.

My question is this. How do I reformat my disk in fat32. Maybe it can't be done after it has been formatted in NTFS. I don't know.
Any thoughts?

fuzzyworm 12-31-2007 05:37 AM

Jschiwal gave instructions for making ntfs writeable above.
Quote:

If you modprobe the fuse module and install the ntfs-3g package, you will be able to mount your windows partition in read-write mode. Because of the different permissions that are used by windows, you should use tar to backup your home directory, and then you can backup the tar file when you backup windows. This will also allow incremental backups.
As for why you can't seem to format the disk as FAT32 - I don't know why this would be. Try using the Debian installer to format the disk as FAT32, then cancel the installation and install Windows. Once Windows is installed on the FAT32 partition, you should be able to install Debian.

As for why Windows was not on the boot menu, I can only guess that this was because the system was FAT not FAT32, as it's not a problem I've had before - as long as the Windows system has been bootable, Debian installer has always been able to include it in the GRUB menu. You may need to post something in the GRUB part of this forum to resolve that one.

Simon Bridge 01-01-2008 09:57 AM

Coming from...
http://www.linuxquestions.org/questi...5/#post3006202
... in that thread I have asserted that linux is able to read/write to ntfs. Was challenged by sofasurfer to come here and back up my words. So here I am...

As I understand the situation, the idea is to copy linux files to a windows partition so that the windows backup tools can be used to create simple backups.

Standard lecture: you do not want to use windows for this. Use linux to backup windows - much more reliable. That said...

The initial result:
Code:

daryl@24-236-143-115:~$ cp -ir /home /mnt/windows/linux
bash: /$: No such file or directory

... this occurred because the partition was not mounted or the mountpoint had not been created. You would normally check with

ls /mnt
ls /mnt/windows

The cp command should be using the archive option.

The second try:
Code:

24-236-143-115:/home/daryl# cp -r /home /mnt/windows/linux
cp: cannot create directory `/mnt/windows/linux/home': Operation not permitted

... this occurred because you did not mount the windows file-system read/write. You have to use ntfs-3g, which subsequent posts have directed you to try.

(Note: In debian, there is a deb package in the repos for this: sudo apt-get install ntfs-3g, IIRC, should install the tool and activate the fuse module as well.) Installing ntfs-3g is called "enable NTFS writing in Linux"... as fuzzy said.


This leads to some important questions:
For some reason you have chosen not to use this method, why not?
What method are you using to mount?
Is this vanilla ntfs or encrypted or other?

As for your formatting issues with FAT32... you are using a proprietary partition tool to do this. There is no telling what it thinks it is doing, and "always worked before" means nothing. It doesn't work now. This is not a linux issue - suggest just reinstall to ntfs since that is what works (though you can try parted, and format vfat).

However - fuzzyworm's suggestion was not to reinstall windows to fat32. The suggestion was to create a fat32 partition (use parted) - say, 4GiB - and use that as your linux backup. Windows can give it a drive letter and you're away.

This doesn't concern me. I'm here to talk about ntfs in linux. But it does highlight the conclusion, below.

In conclusion, your continued issues stem from failing to follow advise. The advise offered has been sound, but a tad general... this is because you have failed to supply some needed information.

frenchn00b 01-01-2008 05:55 PM

Code:

cp -a /home/folder  /tmp
isnt it also copying the folder + subdir. ?

Simon Bridge 01-01-2008 07:42 PM

From cp man page:
Code:

-a, --archive
              same as -dpR

OP is using "cp -r" ... what happens to permissions and symbolic links? I don't think ntfs supports unix file permissions IIRC ntfs-3g has a way around this, but it's "experimental". But this is (partly) why I strongly advise against using windows to backup GNU/Linux or Unix files.

http://en.wikipedia.org/wiki/NTFS
http://en.wikipedia.org/wiki/NTFS_3G

Lets hear from OP before taking this further.


All times are GMT -5. The time now is 05:54 PM.