LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-14-2010, 08:29 AM   #1
drManhattan
Member
 
Registered: Aug 2010
Location: Warsaw, Poland
Distribution: Ubuntu 10.04 LTS on IBM Lenovo R61e, RHEL5-6,SLES10-11
Posts: 262

Rep: Reputation: 1
move file system content between 2 disks


Hi

I have to move all the files and directories between 2 file systems.

Is it good practice to move them at once or first copy them and then move ?
How to do this to preserve the permissions and directory structure ?

thx for help.
 
Old 10-14-2010, 08:43 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
You can use 'cp -ax'; the '-a' flag preserves attributes and links (and is recursive), while the '-x' flag prevents problems if the destination is mounted as a subdirectory on the first file system. See the manpage for details.

It is wise to avoid using 'mv' where it is a complex copy; failures halfway through can be messy.

If the two file systems are not both POSIX (eg moving ext3 to vfat), you won't be able to preserve the permissions correctly.

Last edited by neonsignal; 10-14-2010 at 08:47 AM.
 
Old 10-15-2010, 06:27 PM   #3
mago
Member
 
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with 2.6.16.18 (still off the hook)
Posts: 284

Rep: Reputation: 33
You can also use rsync, rnsapshot or even dd to accomplish this.

The best part of rsync is that you can restart and will pick up where it left.
 
Old 10-15-2010, 07:35 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,139

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
All the above is fine, except "dd". Do not use dd. It is not filesystem aware (deliberately), and will replicate errors silently. Will even introduce inconsistencies depending on options chosen.
Only to be used for taking image copies for recovery/forensic purposes IMHO.
 
  


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
File system corrupted, how to move LVM drives to another machine to recover files? Arodef Linux - Hardware 1 08-07-2009 06:19 PM
shell script to move files from one system to another sytem with file names in a txt coral_km Linux - Newbie 3 02-13-2008 10:23 PM
LXer: Move an entire file system on a live Unix system LXer Syndicated Linux News 0 07-08-2006 05:33 PM
RHEL 3: Steps of expanding file system (add new SCSI disks) to existing SW RAID & LVM atman1974 Linux - General 2 01-12-2006 09:49 PM
how to move a file to a different file system? iclinux Linux - Newbie 1 07-06-2005 10:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:56 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