LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-20-2012, 02:49 PM   #1
AnApproach2DigestLinux
LQ Newbie
 
Registered: Nov 2012
Posts: 6

Rep: Reputation: Disabled
Smile How do I copy specific files and dirs from partition A to B in the same Hdd in Linux?


I am new in Red Hat linux world and would like to know

a)How I should copy specific files and dirs from one partition to another in the same hard disk in Red Hat Linux and list them after copy process?

b)How I should copy specific files and dirs from one hard disk to another hard disk in the same machine in Red Hat Linux and list them after copy process?

For windows it is very easy and straight forward but in linux I really spent alot of time but did not find what I am loking for. What I found sofar is cloning of whole partition and disk or transfer/migration of whole data. Which is not my requirement.

Any help little or big has alot of meaning for me. This forum is ocean of knowledge and I am sure you guys will not let me go empy handed.

(Thanks everybody)
 
Old 11-20-2012, 02:58 PM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Hello, welcome to LQ,

the most common helpsystem in Linux/Unix are the manpages. You can open a manpage for a command (for example cp) with
Code:
man cp
I would recommend that you read the manpages for "cp", "tar" and "mount" for help with your question. There is a Howto about using the manpages here: http://docs.slackware.com/howtos:gen...es_efficiently

There is a useful tutorial in the internet here: http://rute.2038bug.com/index.html.gz

Markus
 
2 members found this post helpful.
Old 11-20-2012, 04:04 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154
The partitions must be mounted.

Example :
# mkdir /mnt/sda3
# mkdir /mnt/sda7

# mount -t auto /dev/sda3 /mnt/sda3/
# mount -t auto /dev/sda7 /mnt/sda7/

# cp /mnt/sda3///<file> /mnt/sda7/<destination>
# cp -a /mnt/sda3///<directory> /mnt/sda7/<destination>

.. If one of the partitions are your current working OS :
No "mount" is required.

.
 
1 members found this post helpful.
Old 11-20-2012, 04:29 PM   #4
tekhead2
Member
 
Registered: Apr 2004
Distribution: slackware/FreeBSD/Vector
Posts: 291

Rep: Reputation: 52
Also you may want to consider the rsync command if these files are system files or have special permissions.
 
Old 11-20-2012, 05:47 PM   #5
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
in addition to man cp, do man rsync.

simple example

you have files in /stuff and want them and the entire directory in /foo

rsync -aviS /suff /foo

problem solved. not only will it copy every file in /stuff to /foo, but you will preserve permissions, ownership, symlinks, and get a verbos printout on the screen of exactly what is happening during the copy.
 
Old 11-20-2012, 07:05 PM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Copying files between different partitions on the same drive or between wholly independent drives is no different than just copying files from one directory to another.

In Linux, all files/directories, regardless of what partition or drive they physically sit on, live under ONE tree. This is very different than in Windows where each drive/partition has its OWN tree. In linux, you mount a drive/partition to a specific directory on your existing tree. From then on, anything copied to that directory will be copied to the drive that is mounted there.

So, if you have partition A mounted at /mnt/A, and you have partition B mounted at /mnt/B, you can copy back and forth between the directories however you want. "cp /mnt/A/file /mnt/B", or you can use rsync, or you can even do it graphically in the file browser.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] copy all partition contents from one HDD to another cccc Debian 4 10-20-2012 08:55 PM
copy svn working dir without svn hidden dirs and files? erinspice Linux - Software 4 03-29-2011 06:58 PM
Copy files from windows to linux partition nataly Linux - Newbie 6 10-09-2007 12:08 PM
Copy files from Windows partition to Linux partition Shibumgeorge Linux - Software 3 04-20-2007 11:08 AM
Canīt see certain files/dirs in debian partition jimdaworm Slackware 2 10-11-2004 07:54 AM


All times are GMT -5. The time now is 11:27 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration