UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor eliezer
Visitor
188 Views
Registered: ‎03-21-2019

Write error: no space left on device (Petalinux rootfs size)

Jump to solution

I am trying to copy a sizeable file (200MB) from an SD card into the root filesystem of a custom Petalinux board.

Partway through, the copy errors out with "write error: No space left on device". I assumed that all this meant was that I needed to increase the size of the rootfs, so I used 

petalinux-config -c kernel

to edit the Default RAM Disk size. I doubled the amount of RAM specified in this value (I made sure it was still within the limits of the actual RAM on the device), but after rebuilding the device, the copy errored out in the exact same place: about 65MB in.

Is there some other setting that limits the amount of memory that ROOTFS is allowed to use? I am only attempting to copy as root.

0 Kudos
1 Solution

Accepted Solutions
Scholar rfs613
Scholar
166 Views
Registered: ‎05-28-2013

Re: Write error: no space left on device (Petalinux rootfs size)

Jump to solution

How much RAM do you have? The ramdisk is implemented using a "tmpfs" filesystem, and by default this is limited to half of your physical RAM.

 

You can check the size after booting using the "df" command. For example, the following is on a system with 256MB of RAM, and as you can see, max size is somewhat less than half (because the kernel code and data takes some space).

Filesystem              Size        Used Available Use% Mounted on
tmpfs 116.4M 8.3M 108.1M 7% /

It is possible to temporarily alter the limit by "remounting", for example:

mount -o remount,size=200M /

However in most cases, tying up >50% of your RAM with large file(s) is counter-productive. Any code that wants to use that data is likely to encounter problems due to lack of free memory. If possible, consider storing large data on non-volatile storage, such as flash or SD card.

7 Replies
Visitor eliezer
Visitor
176 Views
Registered: ‎03-21-2019

Re: Write error: no space left on device (Petalinux rootfs size)

Jump to solution

Alternatively, if anyone knows how to cut down on the size of the image produced by Petalinux, that would likely solve my issue as well. I added some components, and the size of the image increased from 50MB to 225MB. I removed some of the components and rebuilt the image, but the size stayed the same.

0 Kudos
Scholar rfs613
Scholar
167 Views
Registered: ‎05-28-2013

Re: Write error: no space left on device (Petalinux rootfs size)

Jump to solution

How much RAM do you have? The ramdisk is implemented using a "tmpfs" filesystem, and by default this is limited to half of your physical RAM.

 

You can check the size after booting using the "df" command. For example, the following is on a system with 256MB of RAM, and as you can see, max size is somewhat less than half (because the kernel code and data takes some space).

Filesystem              Size        Used Available Use% Mounted on
tmpfs 116.4M 8.3M 108.1M 7% /

It is possible to temporarily alter the limit by "remounting", for example:

mount -o remount,size=200M /

However in most cases, tying up >50% of your RAM with large file(s) is counter-productive. Any code that wants to use that data is likely to encounter problems due to lack of free memory. If possible, consider storing large data on non-volatile storage, such as flash or SD card.

Visitor eliezer
Visitor
162 Views
Registered: ‎03-21-2019

Re: Write error: no space left on device (Petalinux rootfs size)

Jump to solution

The device has 4GB of RAM, but it looks like the filesystem only sees 2.7 GB of it.

This is the output of df:

Filesystem                Size      Used Available Use% Mounted on
devtmpfs                  1.1G      4.0K      1.1G   0% /dev
tmpfs                     1.3G     80.0K      1.3G   0% /run
tmpfs                     1.3G     72.0K      1.3G   0% /var/volatile
/dev/mmcblk0p1            7.4G    431.0M      7.0G   6% /run/media/mmcblk0p1

As you can see, the root file system doesn't even show up.

 

When I try your remount command, I get

mounting rootfs on / failed: invalid argument

I think that ROOTFS is technically still the boot partition, even during runtime, and is never mounted.

 

 

However in most cases, tying up >50% of your RAM with large file(s) is counter-productive.

I know, I am just trying to get something working, and then go from there.

0 Kudos
Highlighted
Visitor eliezer
Visitor
155 Views
Registered: ‎03-21-2019

Re: Write error: no space left on device (Petalinux rootfs size)

Jump to solution

I changed the remount command to say, size=75%, and it worked! Thank you so much. I am curious though, do you know where this value is specified within the PEtalinux configuration?

0 Kudos
Scholar rfs613
Scholar
154 Views
Registered: ‎05-28-2013

Re: Write error: no space left on device (Petalinux rootfs size)

Jump to solution

@eliezer wrote:

The device has 4GB of RAM, but it looks like the filesystem only sees 2.7 GB of it.


Interesting... any chance there is a large amount of memory reserved for some kind of processing (video buffers, DMA engine, etc?) There's a kernel subsystem called "CMA" that is sometimes used for this sort of thing.

 


When I try your remount command, I get

mounting rootfs on / failed: invalid argument

I think that ROOTFS is technically still the boot partition, even during runtime, and is never mounted.


Hmm, yes that's possible. Maybe you can work around it by specifying the device and the mountpoint:

 

mount -o remount,size=2G /dev/root /

 

I also note that the SD card appears in your "df" output... could you just store the file there? If necessary you can make  symlink from the ramdisk to its actual location.

0 Kudos
Visitor eliezer
Visitor
146 Views
Registered: ‎03-21-2019

Re: Write error: no space left on device (Petalinux rootfs size)

Jump to solution

any chance there is a large amount of memory reserved for some kind of processing (video buffers, DMA engine, etc?)

Yes, I'm pretty sure the device has something like that.


I also note that the SD card appears in your "df" output... could you just store the file there?


The file is already on the SD card. I guess there's no reason I have to move it to the rootfs, now that I think about it... I'll just have to change where the source code looks. Thanks for your help!

0 Kudos
Scholar rfs613
Scholar
145 Views
Registered: ‎05-28-2013

Re: Write error: no space left on device (Petalinux rootfs size)

Jump to solution

@eliezer wrote:

I changed the remount command to say, size=75%, and it worked! Thank you so much. I am curious though, do you know where this value is specified within the PEtalinux configuration?


Oh great, glad that worked. The default setting for this is buried inside the Linux kernel source code. In theory I guess you could change this, but I doubt Petalinux has any config setting for this.

 

https://github.com/torvalds/linux/blob/master/mm/shmem.c#L111

static unsigned long shmem_default_max_blocks(void)
{
	return totalram_pages() / 2;
}