Migrating Windows Data To Ubuntu Server Using “cp” – For Newbies

Migrating Windows Data To Ubuntu Server Using “cp” – For Newbies

I just migrated a client from a peer-to-peer Windows network to an Ubuntu 10.04 LTS/SaMBa file-server.

Moving the data was the simplest, yet most time-consuming part of the project. Time consuming in that this client has several hundred GB of data to be copied.

My first step was to mount the Windows share in the new Ubuntu server:

Create your mount point:

$sudo mkdir /path/to/mountpoint

eg: $sudo mkdir /mnt/winshare

Now mount the directory on the server using the Windows Workstation user account.

$sudo smbmount //windowscomputername/sharename /path/to/mountpoint -o username=windowsusername,password=windowspassword,rw

eg: $sudo smbmount //Workstation1/clientdata /mnt/winshare/ -o username=foo,password=bar,rw

Create the local directory where you will be putting the files:

eg: $sudo mkdir /shares/clientdata

Now it’s time to copy the data from the Windows PC to the Ubuntu server:

Change Directory to the local mounted volume:

$cd /mnt/winshare

Now cp all the data to the new location on the Ubuntu server:

$sudo cp -r -n -v -p * /shares/clientdata/

Where * indicates a copy of all directories and files in the current directory. The -r flag tells cp to do a recursive copy into all sub-directories. The -n flag means “no clobbering” (do not replace existing files when copying). The -v flag is a verbose copy, (I like to get feedback from commands I run…). And the -p flag preserves file and folder information, (creation date, user, modification date, etc.).

Now it’s a simple matter of configuring your SaMBa server, (smb.conf), to be a PDC and create the drive mapping for your Windows users.

Sorry, comments are closed for this post.

© Copyright Nathan Mino 2022. All rights reserved.
Use of this web site constitutes acceptance of the nathanmino.com Terms Of Use and Privacy Policy
Remote Support