# Samba converting character set from old Server to new Server

## jayjay

Hy,

I have a SMB Server runing for 2 Year, now is the time to move to a new more powerful machine . I set up the old smb Server without character set convertion. Now, I'd like to introduce character set conversion on the new server. 

So, how do I move the files from old to new server with keeping permission, creating and touch date, but translating the character set.

Scenarios:

- Copiing with rsync: Keeps the permissions etc. , but does no translation.

- Copiing via smb: Does the translation, but will not keep the permissions.

The old smb.conf does not use charset conversion an the new uses:

```

# smb.conf

client code page = 850 

character set = ISO8859-1

```

Any solutions?

Cheers 

JJ

----------

## jstubbs

Hi jayjay,

The best way to do it is using smb. I don't see why it's not keeping the permissions, though. Are you using the -a option to cp? Or at the very least -p? Assuming you have identical users and groups, I can't see why that wouldn't work. Let us know what you find.

Jason

----------

## jayjay

Hy Jason, 

 if I use "cp -a" all the file information is kept, your are perfectly right. But even the file names. 

 The old server does not have charset transformation, so the files from windows are written in charset cp 850 (windows), so if I have special European characters, they are not displayed right under linux shell. The new server hast charset transformation, so file names are displayed right in Linux and in Windows. 

 So, if i'd use your way, I still need a program/script, that translates cp 850 in ISO8859-15. 

 Cheers JJ

----------

## jstubbs

Sorry for the delay.. I fried my fs.

On your new server, you have client code page = 850 and character set = ISO8859-1 in your smb.conf. On your old server, you have no character translation which implies that all files are stored on the filesystem in cp850. Therefore, if you perform the following from the new server samba should convert the filenames correctly:

```

mount -t smbfs -o codepage=cp850,iocharset=ISO8859-1 //<old server>/<share> /<mount>/<point>

cp -a /<mount>/<point>/" /<new>/<share>/<path>

```

The options tell samba to expect cp850 filenames from the server and give iso8859-1 filenames to Linux. If the filenames don't display correctly on linux, confirm that the translation is the problem by browsing the new share from a Windows box. If it works okay, there may be something wrong with i18n setup on your Linux box. Otherwise, it's back to the drawing board!

Jason

----------

## jayjay

Hy everyone,

I found a way by myself. Copying Files via SMB from one server to 

another really sucks. SMB is extremly slow or to put it in another way:

More overhead than data on the network !

But anyway: Jason showed a way, that seams to work for smaller servers. So thank you. 

A better way is to use rsync to transfer files from on server to another.  It keeps permisions and .... Extremly efficient. To translate the filenames I found a very handy tool:

convmv

http://freshmeat.net/projects/convmv/

http://j3e.de/linux/convmv/

I was a little bit difficult to find, but i finally received a hint from a friend.

So thanks to skam.

Cheers JJ

----------

