LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-26-2006, 11:02 PM   #1
MarkGaleck
LQ Newbie
 
Registered: Oct 2006
Posts: 8

Rep: Reputation: 0
how to copy all files?


I want to copy the whole Linux filesystem tree (including hidden system files and links) into a new directory, say /a.

The distribution I have is a freshly installed RH ES version 4. I tried both command-line cp with various options, and GUI, as root (and taking care not to recursively copy /a into itself). Some files get copied but I get permissions problems, "internal failures" and eventually hangs.

So, what is the best way to do this?

(the reason why I want to do this seemingly weird task, is that the sub-filesystem will be remotely NFS mounted to run on another machine)

Thank you for any insight. Mark Galeck
 
Old 11-26-2006, 11:21 PM   #2
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
try and cp all files in the main folders individually, ie, /bin, /boot, /etc, and so on. when you get to a problem folder then cd into it and try to narrow the folders down to the one that eventually gives you the error, by using wildcards (ie cp all folders that start with just a-n, then if successful m-z, etc.
 
Old 11-26-2006, 11:38 PM   #3
ygloo
Member
 
Registered: Aug 2006
Distribution: slack
Posts: 323

Rep: Reputation: 30
i backup with tar,
first stop any running processes and then

check mount points with "mount":

tar -cvpf dev_hda1.tar (--exclude=dir ) /
( if /dev/hda1 is mounted on "/")

this will archive all devices moounted on "/"

and if "/home" is on partition /dev/hda5
tar -cvpf dev_hda5.tar (--exclude=dir ) /home

extract with "tar -xvpf"
"-p" option is for preserving permissions

Last edited by ygloo; 11-26-2006 at 11:52 PM.
 
Old 11-27-2006, 07:40 PM   #4
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
I use rsync it handles all file types, and even the dev directory with no problem.
Suppose I have a partition mounted at /backup, this is what I would do to backup my entire filesystem:

for i in usr dev bin sbin lib home boot etc opt var; do rsync -a /$i/ /backup/$i/;done

It's that simple.

WARNING: I didn't test this one-liner.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mepis, copy files to thumb drive, files deleted? vremenno Linux - Newbie 6 09-15-2006 11:21 PM
how to copy files using C skie_knite007 Programming 8 05-03-2005 02:29 PM
How do I copy this Files Linux2excel Linux - Newbie 1 04-17-2005 02:13 PM
can't copy files from cd linuxmad Linux - General 2 08-28-2003 11:34 PM
how to copy and paste between files and within files Bheki Linux - General 1 02-05-2002 05:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration