This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Filesystem is corrupted when sharing files from host to the Virtual Platform

I am making tests within the FVP and used the below steps to copy files into the FVP

To "bake" files into the target filesystem the following steps need to be followed:

  1. Mount the filesystem image on a local host directory
  2. Edit the mounted filesystem to include the desired files
  3. Unmount it and boot the target as usual

When i create a new file or copy a folder into the filesystem. I get the following error. This error doesn't occur when the existing files are recompiled or changed.

Is there any solution to overcome this issue?

  • You've invoked:

    lkvm run -k test_mem.flat -m 24 -c 1 --name guest-196

    I am not familiar with "lkvm" command but searching it in the Internet, I've found the git repo at https://github.com/lkvm/lkvm .

    Fatal: Unable to open kernel test_mem.flat

    And, searching the error above in the repo, I've found the code below emits the error.

    lkvm/kvm.c at master · lkvm/lkvm · GitHub

    Calling open() dies with the error below so I suspect the file test_mem.flat has some issue.

    EXT4-fs error (device vda2): ext4_lookup:1838: inode #20: comm lkvm: deleted inode reference: 791

    Searching the ext4_lookup error above in the Internet, a couple of article suggest running fsck to fix this type of filesystem (ext4) issue.


    I hope this helps.

    Kind regards,
    Toshi

  • BTW, I don't know if any of your steps causes the filesystem to be corrupted but more detailed explanations might be useful for others in the Forum to come up with an idea.

    1. How do you mount the filesystem image located on the host? For example, do you use P9 or NFS to share files on the host with FVP?

        And, since it's a filesystem image, do you loop-mount the file? (What is the exact command lines you invoked for the "mount" command?)

    2. How do you include files into the filesystem? For example, do you use the "cp" command?

    3. It's often the case that storages are cached, so running a traditional custom to close filesystem may solve the issue i.e. run "sync; sync; sync;" right after unmounting. Can you please give it a try?

  • Hello Toshihisa,


    Thank you for your reply.
    I tried the sync command, and various other solutions to this problem and unable to fix this issue yet.

    Below you can find the steps I used to copy the files to the VP, that created this filesystem issue.

    1) Create a new image from the grub-buildroot.img using dd
    dd if=$PWD/buildroot_fvp_cca/output/rdfremont/grub-buildroot.img of=$PWD/buildroot_fvp_cca/output/rdfremont/grub-buildroot.img2 ibs=512 skip=43008 count=409600

    2) Mount using fuse-ext2
    fuse-ext2 $PWD/buildroot_fvp_cca/output/rdfremont/grub-buildroot.img2 $PWD/tmp/buildroot_mount -o rw+,uid=$UID

    3) copy new files c files to kvm unit tests and do cross compilation
    ./configure
    make all

    (Note that all the object files are generated again, which is not reflected properly within the VP)

    4)Unmount using fuermount
    fusermount -u tmp/buildroot_mount

    5) copy the filesystem back into grub-buildroot.img using dd
    dd if=$PWD/buildroot_fvp_cca/output/rdfremont/grub-buildroot.img2 of=$PWD/buildroot_fvp_cca/output/rdfremont/grub-buildroot.img bs=512 seek=43008 count=409600 conv=notrunc

    6)start the VP
    Then the ext4-fs problem shows up within the VP

    Any hint at the solution is greatly appreciated.

    Best Regards,
    Pooja

  • Hi Pooja,

    Thank you for the details. Can I assume the steps from 1 to 5 are run on the host? If yes, the issue is unrelated to the FVP.

    Can you please:

    1. Check if the grub-buildroot.img at step 1 is identical to the one created by step 5 without running step 3?

    2. Verify if the img created by step 5 is valid? (Do you see all the object files generated by step 3 if you mount the img at step 5 by fuse-ext2?)

    3. Check if the size of the object files generated by step 3 can be held in the ext2 file partition? (In other words, is the size less than 409600 * 512 bytes?)

    Kind regards,

    Toshi

  • Hi Toshihisa,

    Thank you for your reply. 
    1) Yes the images without the compilation step are the same.
    2) I can mount the files any number of times on the host without any missing files.
    3) I have solved this problem by creating extending the size of the image and copying the files into a new ext3 partition without touching the existing one. I am now able to see the files inside the VP without any issues.

    The original problem remains unsolved, yet we have a solution for test setup.  :) 

    Best Regards,
    Pooja