Results 1 to 11 of 11
  1. #1
    Join Date
    Apr 2009
    Posts
    1,320

    Question Need to move 1TB data to another hard drive on same server

    I need to move these folders from old hard drive to new hard drive while keeping same file permission and ownerships.

    /home3/folder1 --> /home/folder1
    /home3/folder2 --> /home/folder1

    What is the correct command to do this?

  2. #2
    Join Date
    Mar 2009
    Location
    Austin, TX
    Posts
    934
    Code:
    cd /home; tar cBplfz - -C /home3 folder1 |tar xBplfz -
    Code:
    cd /home/folder1; tar cBplfz - -C /home3/folder2 . |tar xBplfz -
    Above is one way. Just checking and make sure you are not making typos... you want both old folder to be copied into the same folder /home/folder1 right?
    SysAdmin.xyz
    Having severs with customer data on it without proper monitoring is like having one night stand without using protections - eventually, there will be an 'oh s**t!' moment.

  3. #3
    Join Date
    Apr 2009
    Posts
    1,320
    Actually is a typo should be folder2 --> folder2

    I don't think can tar this since there is 1TB of data.

  4. #4
    Join Date
    Jan 2011
    Location
    India
    Posts
    13
    If you need to copy use the following
    -------------------------------------
    cp -pr /home3/folder1/ /home/
    cp -pr /home3/folder1/ /home/

    If you need to move use the following
    -------------------------------------
    mv /home3/folder1/ /home/
    mv /home3/folder1/ /home/

  5. #5
    rsync is best as you can stop/resume if needed.

    rsync -azv /home3/folder1/ /home/folder1/
    rsync -azv /home3/folder2/ /home/folder2/

  6. #6
    Join Date
    Jul 2009
    Location
    Indiana
    Posts
    2,193
    If you do use rsync, you may or may not want to use the -z flag for compression. Compression is mostly useful when moving data across a network, but it may not be worth it if you're copying within the same machine, since it does take some cpu to compress the data.
    Sam Barrow - CEO @ SQUIDIX (1-855-SQUIDIX)
    Ask Us About Sponsoring Your Web Site (High Traffic Sites Only)
    Squidix - Shared, Reseller, Semi-Dedicated, Managed VPS and Managed Dedicated Hosting
    Midwestern Web - Web Design & Development Services

  7. #7
    Join Date
    Apr 2009
    Posts
    1,320
    I already started using the cp command, the folder has 800GB of data, I should've used rsync instead. But I don't see the need to stop/resume, even if I get disconnected to the server in SSH, the files are still being copied right?

  8. #8
    Join Date
    Jul 2009
    Location
    Indiana
    Posts
    2,193
    If you get disconnected the command will stop, unless you run it with nohup.

    You can always start using rsync now, it will pick up after what you've already copied with cp.

    If you want to run it in the background -

    nohup rsync -av sourcefolder destinationfolder &

    Don't forget the & at the end.
    Sam Barrow - CEO @ SQUIDIX (1-855-SQUIDIX)
    Ask Us About Sponsoring Your Web Site (High Traffic Sites Only)
    Squidix - Shared, Reseller, Semi-Dedicated, Managed VPS and Managed Dedicated Hosting
    Midwestern Web - Web Design & Development Services

  9. #9
    Join Date
    Apr 2009
    Location
    whitehouse
    Posts
    656
    You should have executed the cp command in screen so that the copy would have continued even if you had got disconnected.

    Quote Originally Posted by chasebug View Post
    I already started using the cp command, the folder has 800GB of data, I should've used rsync instead. But I don't see the need to stop/resume, even if I get disconnected to the server in SSH, the files are still being copied right?
    James B
    EzeeloginSetup your Secure Linux SSH Gateway.
    |Manage & Administer Multiple Linux Servers Quickly & Securely.

  10. #10
    Join Date
    Apr 2009
    Posts
    1,320
    Quote Originally Posted by BarackObama View Post
    You should have executed the cp command in screen so that the copy would have continued even if you had got disconnected.
    Can you explain what is running the command in screen?

    I have already finished moving everything but would like to know that for future reference.

    Thanks!

  11. #11
    Join Date
    Mar 2007
    Location
    East Lansing, Michigan
    Posts
    86
    Quote Originally Posted by chasebug View Post
    Can you explain what is running the command in screen?
    http://en.wikipedia.org/wiki/GNU_Screen

    Very handy if you're doing something on a remote system that you think you might get disconnected from, and want to get right back to where you left off. Also good for multitasking from a single session.

Similar Threads

  1. Replies: 0
    Last Post: 09-16-2009, 08:11 AM
  2. How to transfer data from hard drive to hard drive in Linux?
    By wifiguru in forum Dedicated Server
    Replies: 8
    Last Post: 03-26-2007, 04:02 PM
  3. Use 2nd hard drive for database instead of having 1 drive do it all,smart move?
    By [email protected] in forum Hosting Security and Technology
    Replies: 5
    Last Post: 08-13-2005, 07:12 PM
  4. Would you buy a 1tb hard drive?
    By Criminal#58369 in forum Web Hosting Lounge
    Replies: 27
    Last Post: 06-12-2005, 04:15 AM
  5. How do I move data from one hard drive to another for cpanel/OS reinstall?
    By jonmck1234 in forum Hosting Security and Technology
    Replies: 6
    Last Post: 08-07-2003, 12:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •