File copy issue in Solaris


 
Thread Tools Search this Thread
Operating Systems Solaris File copy issue in Solaris
# 1  
Old 10-13-2015
File copy issue in Solaris

Dears,

I have one strange problem. When I copy file from source to destination using scp, file size decreased in destination side. I can see that copy progress is successful in source side. But when I check file size using
Code:
du -sh

command file size is 10 time smaller.
First I looked into network. But there wasn't any network interrupt. So I changed destination directory to /tmp in scp copy command. After that I checked file size on destination side and it was correct size. Then I copied file from /tmp to /backup on destination side and checked file size. File size was 0k very strange.

I think there's some disk issues in the server. Also checked zfs filesystem using
Code:
zfs list
zpool list
zpool status -x  commands.

They are all fine. Have you seen this issue ever?
# 2  
Old 10-14-2015
How did you determine that the size of the copy was zero?

On a ZFS filesystem, copying file1 to file2 might share disk block allocations between the two files until some bytes in one of the files is overwritten. In that case a du -s file1 file2 might show 0 blocks allocated to file2 while du -s file2 file1 might show 0 blocks allocated to file1, and du -s file1 followed by du -s file2 (in separate invocations of du) would show the same (non-0) size for both files.
# 3  
Old 10-14-2015
I used du -sh command to determine the size of the copy. I just found that file size in destination directory is increasing. It was 0K about 30 min ago and now it's 7.2M. So that means I need to check disk read write performance, right?

---------- Post updated at 02:41 PM ---------- Previous update was at 11:45 AM ----------

I found that this issue appeared on only disk from SunStorage M2500M2 array.
# 4  
Old 10-14-2015
Quote:
Originally Posted by sembii
I used du -sh command to determine the size of the copy. I just found that file size in destination directory is increasing. It was 0K about 30 min ago and now it's 7.2M. So that means I need to check disk read write performance, right?

---------- Post updated at 02:41 PM ---------- Previous update was at 11:45 AM ----------

I found that this issue appeared on only disk from SunStorage M2500M2 array.
Did you read what I said in post #2 in this thread?

You haven't told us anything that would allow us to guess what, if anything, is wrong:
  1. How big is the source_file?
  2. Exactly what command are you using to copy the file?
  3. Exactly what du command did you use to check the destination_file size? Why didn't you use ls -l instead of du to check the destination_file size?
  4. Are the source and destination files on the same filesystem?
  5. Did the command you are using to copy the file complete? If so, what was its exit status? What diagnostic messages did it produce?
  6. Are the sizes from du -s destination_file and ls -l destination_file consistent?
  7. Are any diagnostics being written to the system consoles (or error logs) while the file is being copied on the source system and on the destination system? (Any diagnostics; not just disk problems.)
  8. What operating systems (including versions) are being run on the source and destination systems?
  9. What makes you think you have disk read/write performance problems as opposed to network performance problems?
# 5  
Old 10-15-2015
Hi Don Cragun,

Yeah, read your post, sorry for not enough details. Here are some details.
1. Source file size is 10mb. Actually there are many files with the size greater than 10GB. But I chose 10mb sized one file as test.
2. I'm using cp and scp both.
scp -C source_file oracle@remote_host:/path/to/dir
cp source_file /path/to/destination

3. I used du -sh command to see file size. ls -l command shows the size same as source file. But du -sh command shows different size. I think that ls -l command is showing only file size info in the header and du -sh command is showing size on the disk.
4. Yes, source and destination filesystem are same. I'm using Solaris ZFS filesystem
5. Yes, command completed without error.
6. du -sh and ls -ltr results are different. Please see 3th answer.
7. Already checked if there's any log. But I didn't see any log.
8. Solaris 10 runs on both source and dest server.
9. If I copy files from source server to local disk of the remote server it copies file without issue. All file sizes are correct.
If I copy file from source server to sunstorage disk of the remote server, copied file size is decreased. That means this issue is related to SunStorage.

---------- Post updated at 01:51 PM ---------- Previous update was at 11:27 AM ----------

I'm checking storage and will share the result here.
# 6  
Old 10-15-2015
Check if your zfs filesystem in question is using compression and/or deduplication.
That can cause confusion with du, if you are not aware that it is turned on.

GNU du has --apparent-size which can be usefull on zfs filesystems and is present as gdu on Solaris 11 and later.

Also you might want to run md5sum or cksum to check if the files are the same on source and destination.

Hope that helps
Regards
Peasant.
# 7  
Old 10-15-2015
Quote:
Originally Posted by Peasant
Check if your zfs filesystem in question is using compression and/or deduplication.
That can cause confusion with du, if you are not aware that it is turned on.

GNU du has --apparent-size which can be usefull on zfs filesystems and is present as gdu on Solaris 11 and later.

Also you might want to run md5sum or cksum to check if the files are the same on source and destination.

Hope that helps
Regards
Peasant.
Deduplication is what I was talking about in post #2 in this thread. But comparing the source and destination is going to fail if du is showing that the destination is growing over time after the copy completes.

I asked for the EXACT du command that was being used to look at the size of the destination file and was told that the command used was:
Code:
du -sh

which will not tell you the number of blocks allocated to any particular file; it gives you the number of disk blocks allocated to all files in the file hierarchy rooted in the current working directory that are in the same filesystem as the current working directory.

The fact that ls -l shows the correct file size is a clear indicatory that the copy completed successfully and if:
Code:
du -sh source_file destination_file

is showing destination_file with in initial allocation of 0 blocks after the copy completes and an increasing allocation as time passes, it means that new blocks are being allocated to destination_file as blocks in source_file and/or destination_file are being changed after the copy completed.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue with copy command

Hi, I have a shell script which is having copy command. My need is to copy all the files in a directory into its subdirectory. My directory structure is like this. Dir1 file1.txt file2.txt file3.txt subDir1 subDir1 is a subdirectory in Dir1. Now I... (2 Replies)
Discussion started by: yuvi
2 Replies

2. Shell Programming and Scripting

how to copy the directory but not copy certain file

Hi experts cp bin root src /mnt but not copy bin/bigfile any help? ( I post this thread in the "redhat" forum wrongly, I don't know how to withdraw that question in that wrong forum) Thanks (6 Replies)
Discussion started by: yanglei_fage
6 Replies

3. UNIX for Dummies Questions & Answers

Issue with Reflection - text copy beyond screen.

Hi, Gretings, While viewing the contents of a file using more/cat in Reflection, I am neither able to see the text beyond the width of screen, nor able to type it as well. I have tried changing windows settings also, but of no vail. Even if I cat/more a file and try to copy its contents, it... (1 Reply)
Discussion started by: dipanchandra
1 Replies

4. Shell Programming and Scripting

Unzipping a file in Solaris - Issue with xls file

Hi, I have an excel file generated by system in windows. I am zipping it, transfering to unix and unzipping there. But i'm getting below output while unzipping. $ /usr/bin/unzip -a 123.zip -d . Archive: 123.zip inflating: ./123/Index.xls When i copy this unzipped xls file to... (0 Replies)
Discussion started by: ajaykumarb
0 Replies

5. Shell Programming and Scripting

Solaris KSH shell script to copy all lines from one file to another

Hello, more of a windows wscript guy. However I took a new position that requires me to support some solaris servers. So... issue is that I need to copy all lines from a file to a temporary file and then copy them back into the original file starting at line 1. Reason I need to do this is... (5 Replies)
Discussion started by: ZigZaggin
5 Replies

6. UNIX for Dummies Questions & Answers

Issue with the copy command

Hi, I was copying a bunch of files from one folder to another.. while copy command was running i pressed 'ctrl C'...now these files are not present in the parent directory nor in the target folder... :eek: Where can find these files... Is there any way to get this files back.. :confused:... (2 Replies)
Discussion started by: Amey Joshi
2 Replies

7. Solaris

need to copy file from solaris to windows

Hi my OS is solaris 9 , we have requirement to copy 1 file from solaris box to windows machine , so which utility or commands any idea will be appreciated Regards (3 Replies)
Discussion started by: maooah
3 Replies

8. Filesystems, Disks and Memory

on solaris best utility to copy a file system?

Hi, - on a solaris box what is the best utility to copy a whole file system from one place to other? - the aim of the operation is to place the contents of the whole file system to other file system within the discs cp ? - cpio? - tar? - what about file systemes containing symbolic links ?... (1 Reply)
Discussion started by: JAKEZ
1 Replies

9. UNIX for Dummies Questions & Answers

copy from Solaris to HyperTerm

Hello, I try to copy a small file e.g. /etc/hosts from my workstation to my office Pc via serial cable on Port b. (/dev/term/b) But I donīt now how! On the Pc I can only use the HyperTerm on NT because this is the released software. There is an option to send or receive data but i have no idea... (11 Replies)
Discussion started by: joerg
11 Replies
Login or Register to Ask a Question