Home > Enterprise Linux Tips > Migration & Integration > Moving files in a Unix-to-Linux port
Enterprise Linux Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

MIGRATION & INTEGRATION

Moving files in a Unix-to-Linux port


Ken Milberg
11.03.2004
Rating: -4.50- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Some tasks are so mundane that they're considered no-brainers. Trouble is, people often space out or turn off their brains when performing those tasks and make big mistakes. When doing a Unix-to-Linux port, there are many steps involved in getting to the final product. These include the initial assessment, installing patches, installing porting software, copying over and compressing files, configuring, tuning, testing and ultimately deploying that application. In this tip, we will focus on one of those tasks, perhaps not as sexy as some of the others, but no less critical. That would be moving your files. Before you yawn, let me tell you that I've seen some big goofs made by seasoned IT people who were blasÉ about moving files during a port.

As you know, while Unix and Linux may be similar, they are far from identical. There are many commands available in Unix which are just not available on Linux and vice-versa. Fortunately, many of the utilities used for file copying and compressing data files are similar. For example, let's take the IBM Unix flavor. AIX has things like mksysb, backup and restorevg. Forget all of them, please. You'll need to use plain old vanilla Unix standby types of utilities, such as tar, cpio, or dd, which are all available in some fashion on Linux and Unix.

I've always been a cpio fan because it can back up empty directories, and tar cannot. In fact, I can still recite one of the first commands I used in the 80's on an old Compaq SystemPro (renamed SystemSlow, because of its wonderful performance, for those of you old enough to remember) running SCO Unix 3.2. The command was (and still is) cpio –ocvB >/dev/rmt0. For example, if I wanted to back up all my files in a specific directory to tape, I woud do this:

find ./ -depth -print | cpio –ocvB >/dev/rmt0

Fortunately, the –print is not necessary anymore, so you can just do this:

find ./ -depth | cpio –ocvB >/dev/rmt0

To restore the data, first cd to the directory that you want to restore to, and then try this:

cpio –icdumBv

For more options, or to understand further some of the flags used here, check the main pages for cpio.

Another nice trick with cpio is packing multiple files to one file, and even compressing them. You can do the same things with tar, also. Find ./ -depth | cpio –ocvB | gzip > myfiles.cpio will dump your archive in cpio format and also compress it on the fly. Of course, this is assuming you have gzip, which does not come installed in every Linux/Unix distribution, but many of them.

Tar is another utility you'll need to work with. To do a simple backup, do

a : tar cvf /dev/rmt/0

This will backup files in your current directory in tar format to your tape drive (assuming again, rmt is your device).

To restore the same files, you would issue this command:

tar xvf /dev/rmt/0

This will restore those same files to your current directory, assuming again of course that you backed up the tar files originally in relative and not absolute format.

When backing up these files in tar or cpio, please do not use an "absolute" path, because if you do, you will not be able to choose where you can restore your files to, and that can be critical when you must restore files to a different directory.

Whatever method you choose to backup and restore your data files, be smart and always verify that your files are really on the tape or new disk area before you blow away your data. Never assume anything. Also explore other ways, if possible, of moving over your data. If you have a network in place with your Linux and Unix machine, and they have been configured to already talk to one another, then you may not have to even move over the files this way. You would be able to set up an NFS mount and just copy your files to another directory.

There are many ways to skin a cat, so spend the proper time in planning, and you'll be the wiser for it down the road.


Rate this Tip
To rate tips, you must be a member of SearchEnterpriseLinux.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Enterprise Linux Web Server & Application Server
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2003 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts