LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-27-2012, 03:50 PM   #1
completelinuxnube
LQ Newbie
 
Registered: Jul 2012
Distribution: Slackware
Posts: 22

Rep: Reputation: 0
How do I copy root the file system of an internal hdd to a usb hdd


I have tried, but I must be missing something.
 
Old 07-27-2012, 03:53 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Uh..

Code:
mount /dev/sdd1(or whatever your usb drive is) /mount/usb
sudo cp -rpv /root /mount/usb
 
1 members found this post helpful.
Old 07-27-2012, 04:08 PM   #3
completelinuxnube
LQ Newbie
 
Registered: Jul 2012
Distribution: Slackware
Posts: 22

Original Poster
Rep: Reputation: 0
Thanks Kustom42 for the info. I think I asked the wrong question though. What I meant to ask was, how do you copy the / file system of an internal hdd using rsync to a remote host's usb hdd?
 
Old 07-27-2012, 04:09 PM   #4
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Note, however, that cp -rp / /mount/... will not work because that will attempt to copy several "pseudo" system files (e.g., /dev/null. /dev/random, etc.) that are (logically) infinite in size.

If you want to create an image of your system on a different drive, I'd suggest that to get a copy of Clonezilla and run it from a USB or CD.

Last edited by PTrenholme; 07-27-2012 at 04:11 PM.
 
1 members found this post helpful.
Old 07-27-2012, 04:11 PM   #5
completelinuxnube
LQ Newbie
 
Registered: Jul 2012
Distribution: Slackware
Posts: 22

Original Poster
Rep: Reputation: 0
@PTrenholme thanks for the information.
 
Old 07-27-2012, 04:14 PM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
If you want to use rsync it should look like this:
Code:
rsync -a /* /your/USB/mountpoint --exclude-from=exclude-file
Your exclude-file should look similar to this:
Code:
tmp/*
home/*
var/lock/*
var/run/*
dev/*
sys/*
proc/*
media/*
mnt/*
If you want the file under /home also to be copied just remove home/* from that list, if you want to exclude other directories just add them to that list.

For more information about rsync and its options have a look at
Code:
man rsync

Last edited by TobiSGD; 07-27-2012 at 04:16 PM.
 
3 members found this post helpful.
Old 07-27-2012, 04:35 PM   #7
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
TobiSGD has the right answer, I thought you meant /root/, the explanation given about the pseudo files and devices is completely true.
 
1 members found this post helpful.
Old 07-27-2012, 05:18 PM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,784

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
You can avoid copying other filesystems (both real and pseudo-) with rsync's "-x" (--one-file-system) option. The disadvantage of using that, rather than figuring out the list of what needs to be excluded, is the empty mountpoint directories will not get created at the destination.

You can copy the root filesystem including the mount points (and preserving their original ownership and permissions) this way:
Code:
mkdir -p /mnt/tmproot
mount --bind / /mnt/tmproot
rsync -aH /mnt/tmproot/ remoteSystem:/some/directory
umount /mnt/tmproot
rmdir /mnt/tmproot
The "--bind" option attaches only the single filesystem, not any submounts.

Note that the trailing '/' in the /mnt/tmproot/ argument to rsync is significant since you want to copy the contents of that directory and not create a directory called "tmproot" at the destination. The "-H" option is important for preserving hard links. Without it, hard-linked files are treated as though they were separate files.

As with many things, the devil is in the details.
 
1 members found this post helpful.
Old 08-06-2012, 02:22 PM   #9
completelinuxnube
LQ Newbie
 
Registered: Jul 2012
Distribution: Slackware
Posts: 22

Original Poster
Rep: Reputation: 0
Thanks to everyone for all of the info.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slow USB transfer rates (60kb p/s) External HDD --> Internal HDD drfrostbyte Linux - Hardware 4 03-28-2011 01:20 AM
Move Ubuntu from Internal HDD to External HDD redrocket101011 Ubuntu 3 03-25-2011 05:38 PM
I installed ubuntu 9.04 to my Maxtor external hdd. I have no internal hdd. I can boot dont33 Linux - Newbie 1 08-13-2009 04:13 PM
[SOLVED] Removing Grub from internal HDD and installing it only on external hdd M3GA8U5H Linux - Newbie 5 08-07-2009 01:47 AM
Dual boot XP(internal IDE HDD) Debian(external USB-IDE HDD) using boot.ini PolarDog Linux - Laptop and Netbook 2 07-01-2005 09:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:01 PM.

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