简体   繁体   English

写入错误:嵌入式Linux中的设备上没有剩余空间

[英]write error: No space left on device in embedded linux

all I have a embedded board, run linux OS. 我所有的都有一块嵌入式板,运行linux OS。 and I use yaffs2 as rootfs. 我使用yaffs2作为rootfs。 I run a program on it, but after some times, it got a error "error No space left on device.". 我在上面运行了一个程序,但是一段时间后,出现错误“错误设备上没有剩余空间”。 but I checked the flash, there still have a lot free space. 但是我检查了闪光灯,仍然有很多可用空间。 I just write some config file. 我只是写一些配置文件。 the config file is rarely update. 配置文件很少更新。 the program will write some log to flash. 程序将向闪存写入一些日志。 log size is limited to 2M. 日志大小限制为2M。 I don't know why, and how to solve. 我不知道为什么,以及如何解决。 Help me please!(my first language is not English,sorry. hope you understand what I say) 请帮帮我!(我的母语不是英语,对不起。希望您能理解我的意思)

some debug info: 一些调试信息:

    # ./write_test 
    version 1.0
    close file :: No space left on device
    return errno 28
    # cat /proc/yaffs 
    YAFFS built:Nov 23 2015 16:57:34


    Device 0 "rootfs"
    start_block........... 0
    end_block............. 511
    total_bytes_per_chunk. 2048
    use_nand_ecc.......... 1
    no_tags_ecc........... 1
    is_yaffs2............. 1
    inband_tags........... 0
    empty_lost_n_found.... 0
    disable_lazy_load..... 0
    refresh_period........ 500
    n_caches.............. 10
    n_reserved_blocks..... 5
    always_check_erased... 0
    data_bytes_per_chunk.. 2048
    chunk_grp_bits........ 0
    chunk_grp_size........ 1
    n_erased_blocks....... 366
    blocks_in_checkpt..... 0

    n_tnodes.............. 749
    n_obj................. 477
    n_free_chunks......... 23579

    n_page_writes......... 6092
    n_page_reads.......... 11524
    n_erasures............ 96
    n_gc_copies........... 5490
    all_gcs............... 1136
    passive_gc_count...... 1136
    oldest_dirty_gc_count. 95
    n_gc_blocks........... 96
    bg_gcs................ 96
    n_retired_writes...... 0
    n_retired_blocks...... 0
    n_ecc_fixed........... 0
    n_ecc_unfixed......... 0
    n_tags_ecc_fixed...... 0
    n_tags_ecc_unfixed.... 0
    cache_hits............ 0
    n_deleted_files....... 0
    n_unlinked_files...... 289
    refresh_count......... 1
    n_bg_deletions........ 0

    Device 2 "data"
    start_block........... 0
    end_block............. 927
    total_bytes_per_chunk. 2048
    use_nand_ecc.......... 1
    no_tags_ecc........... 1
    is_yaffs2............. 1
    inband_tags........... 0
    empty_lost_n_found.... 0
    disable_lazy_load..... 0
    refresh_period........ 500
    n_caches.............. 10
    n_reserved_blocks..... 5
    always_check_erased... 0
    data_bytes_per_chunk.. 2048
    chunk_grp_bits........ 0
    chunk_grp_size........ 1
    n_erased_blocks....... 10
    blocks_in_checkpt..... 0

    n_tnodes.............. 4211
    n_obj................. 24
    n_free_chunks......... 658

    n_page_writes......... 430
    n_page_reads.......... 467
    n_erasures............ 7
    n_gc_copies........... 421
    all_gcs............... 20
    passive_gc_count...... 13
    oldest_dirty_gc_count. 3
    n_gc_blocks........... 6
    bg_gcs................ 4
    n_retired_writes...... 0
    n_retired_blocks...... 0
    n_ecc_fixed........... 0
    n_ecc_unfixed......... 0
    n_tags_ecc_fixed...... 0
    n_tags_ecc_unfixed.... 0
    cache_hits............ 0
    n_deleted_files....... 0
    n_unlinked_files...... 2
    refresh_count......... 1
    n_bg_deletions........ 0
    # 

log and config file stored in "data". 日志和配置文件存储在“数据”中。 thanks!! 谢谢!!

In General this could be your disk space (here Flash), first of all check your flash space with with df -h (or other commands you have.. df is present in BusyBox). 通常,这可能是您的磁盘空间(这里是Flash),首先使用df -h(或您拥有的其他命令。.BusyBox中存在df)检查您的闪存空间。 But if your flash space (specially on your program partition) is ok, this could be your "inode" (directory) space problem, you could see your inode usage with df -i command. 但是,如果您的闪存空间(特别是在程序分区上)没问题,则可能是您的“ inode”(目录)空间问题,您可以使用df -i命令查看您的inode用法。
(a good link for this: https://wiki.gentoo.org/wiki/Knowledge_Base:No_space_left_on_device_while_there_is_plenty_of_space_available ) (对此的一个很好的链接: https : //wiki.gentoo.org/wiki/Knowledge_Base : No_space_left_on_device_while_there_is_plenty_of_space_available

If non of these is the problem cause, I think you have to have a deeper look at your code, specially if you deal with disk I/O! 如果不是这些原因,那么我认为您必须更深入地了解代码,尤其是在处理磁盘I / O时! Also good to mention that be aware of memory & heap space & free all allocated spaces in you functions. 还要提一下,要注意内存和堆空间并释放函数中所有分配的空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM