LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-07-2013, 09:42 PM   #1
chinabenjamin66
Member
 
Registered: Mar 2012
Location: Shenzhen Chian
Posts: 73

Rep: Reputation: Disabled
dd with exit code 159.


Hello All,
I want to create a file with size 4GB+ under linux, but it cannot be generated with the following error. please help me!
Code:
/tmp/mnt/sda1
# dd if=/dev/zero of=out4Gplus bs=4M count=1100
File size limit exceeded
# echo $?
159
The platform information:
Code:
# uname -a
Linux tc 2.6.22.15 #1 SMP Fri Dec 14 09:59:02 CST 2012 mips unknown
What other information do you need to explan the issue?


Thanks all.
 
Old 05-07-2013, 10:09 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
You'll need to know which filesystem is in use wherever you are creating the file .. /tmp/mnt/sda1 ?

Try:
Code:
cat /proc/mounts
Once you know which filesystem you can search for the file size limitation.
 
1 members found this post helpful.
Old 05-09-2013, 06:50 AM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
The usual reason for this error is using a filesystem like FAT to try and hold a 4 GB file.

This is a limit of the specific destination filesystem but not the system as a whole.
 
Old 05-09-2013, 03:43 PM   #4
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
I suspect you have a FAT or FAT32 filesystem. If I execute your command on my external USB drive with vfat filesystem (I think that's equivalent to FAT32), the transfer fails when the file size reaches 4GB-1byte. According to Wikipedia, that is the limit of FAT32. I get exit code 1, and more informative messages; I guess that depends on the version of Linux.
Code:
tony> dd if=/dev/zero of=out4Gplus bs=4M count=1100
dd: writing ‘out4Gplus’: File too large
1024+0 records in
1023+0 records out
4294967295 bytes (4.3 GB) copied, 156.61 s, 27.4 MB/s
tony> echo $?
1
If I try it in a ext4 filesystem (here I use my /home partition), it fails upon filling the partition:
Code:
tony> dd if=/dev/zero of=out1T bs=1M count=1M
dd: writing ‘out1T’: No space left on device
13731+0 records in
13730+0 records out
14397227008 bytes (14 GB) copied, 282.76 s, 50.9 MB/s
tony> echo $?
1
 
1 members found this post helpful.
Old 05-15-2013, 02:09 AM   #5
chinabenjamin66
Member
 
Registered: Mar 2012
Location: Shenzhen Chian
Posts: 73

Original Poster
Rep: Reputation: Disabled
Thank you all for your constructive suggestions.

I also tried it on a ext3 file system , and the return message is the same with that. I think it is the kernel configuration limitation for creating files with size larger than specific value, for example 2G.
I attached the usb driver to my PC, and found that the size of the file created is 2G. this is router with embedded linux. can any one tell me how to get the kernel configuration of the linux? I try to figure it out.
 
Old 05-15-2013, 03:05 AM   #6
chinabenjamin66
Member
 
Registered: Mar 2012
Location: Shenzhen Chian
Posts: 73

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by kbp View Post
You'll need to know which filesystem is in use wherever you are creating the file .. /tmp/mnt/sda1 ?

Try:
Code:
cat /proc/mounts
Once you know which filesystem you can search for the file size limitation.
see the following:
Code:
/dev/sda2 on /tmp/mnt/sda2 type ext3 (rw,nodev,noatime,data=ordered)
# cd /tmp/mnt/sda2
# ls
lost+found
# dd if=/dev/zero of=out4Gplus bs=4M count=1100
File size limit exceeded
 
1 members found this post helpful.
Old 05-16-2013, 11:48 AM   #7
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
For what it's worth, this is a bash subroutine I use when creating a copy of compact flash root file systems. Reason being is that I've found that the compact flashes that you buy all have different maximum sizes. So as a result if I copy the entire disk using dd, and copy it to a larger disk for storage, then later try to copy it to another compact flash same sized as the original; for example production copying, you run into size problems if the original one the file was created from happened to be larger sized than the target one. My point here is that not all 4G or 8G flash drives, or thumbsticks have EXACTLY the same number of bytes, therefore it caused problems.

The result was a script, this part copies the root file system (because that's the intent) into a file system large enough to store it, then resizes that file system to the minimum required. Thus removing the unused disk space from the file and reducing the size of the file. The $1 argument is the original /dev/sd<letter> compact flash and the $2 argument is the target file for the RFS, in this case we pretty much always use rfs.ext2 because we do an ext2 file system.

Code:
# Function to copy the root file system
copy_rfs()
{
    sudo /usr/local/bin/genext2fs -b 1024 $2
    # Resize to 8 Gigabytes to perform the copy
    sudo /sbin/resize2fs -f $2 8000000
    sudo mkdir -p copy
    sudo mount -o loop $2 copy
    cd copy
    sudo cp -a $1/* .
    cd ..
    sudo umount copy
    sudo rm -rf copy
    # Check the file system
    sudo /sbin/e2fsck -f $2
    # Resize it to the minimum number of blocks required
    sudo /sbin/resize2fs -M $2
    return $?
}
 
2 members found this post helpful.
  


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
exit(communication error), terminated by calling exit(), return code: 255 miliboy Linux - Newbie 11 02-27-2013 01:51 PM
Exit Code wasamzy Linux - Server 1 11-26-2010 03:11 AM
Exit Code 204 Tim Johnson Linux - General 5 04-25-2006 01:59 AM
Exit Code: 7 dbzw SUSE / openSUSE 0 12-21-2004 01:06 PM
atexit and exit code Gªutama Programming 3 11-01-2003 02:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:46 AM.

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