首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

[linux][fuse]fuse技术分析以及遇到的问题

前言: 简单看了一下glusterfs,使用单节点构造glusterfs环境,导出的路径是是本地SSD在分区上。用qemu挂载glusterfs上的卷,用FIO测试IOPS,测试结果不理想。 大致分析了一下,怀疑fuse会导致性能下降。 分析: 1,libfuse & fuse 为了方便测试和便于分析问题,使用了libfuse。代码地址https://github.com/libfuse/libfuse 编译libfuse比较麻烦,不支持Makefile,需要用meson编译,而且meson的版本要求比较高,不能用apt-get直接安装。操作方法就是下载高版本的meson包,在meson包里面执行python3 setup.py install。 除了用户态的libfuse之外,还需要kernel支持。作者在Ubuntu1804上测试,fuse已经被编译到kernel中。在config文件(内核配置文件即ls /boot/config-`uname -r`)中CONFIG_FUSE_FS。如果是kmod的方式编译,执行modprobe fuse。

03
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    编译hadoop的libhdfs.a

    进入hadoop-hdfs-project/hadoop-hdfs/src目录,执行cmake以生成Makefile文件。 如果遇到如下的错误: ~/hadoop-2.7.1-src/hadoop-hdfs-project/hadoop-hdfs/src]$ cmake . JAVA_HOME=, JAVA_JVM_LIBRARY=/data/jdk/jre/lib/amd64/server/libjvm.so JAVA_INCLUDE_PATH=/data/jdk/include, JAVA_INCLUDE_PATH2=/data/jdk/include/linux Located all JNI components successfully. CMake Error at CMakeLists.txt:84 (MESSAGE):   You must set the CMake variable GENERATED_JAVAH -- Configuring incomplete, errors occurred! 则指定一下cmake参数即可,如下所示: cmake -DJAVA_HOME=/data/jdk -DGENERATED_JAVAH=/data/jdk . 然后带参数再次执行cmake: ~/hadoop-2.7.1-src/hadoop-hdfs-project/hadoop-hdfs/src]$ cmake -DJAVA_HOME=/data/jdk -DGENERATED_JAVAH=/data/jdk . 下面的显示表示cmake成功,会在当前目录下生成Makefile文件: JAVA_HOME=/data/jdk, JAVA_JVM_LIBRARY=/data/jdk/jre/lib/amd64/server/libjvm.so JAVA_INCLUDE_PATH=/data/jdk/include, JAVA_INCLUDE_PATH2=/data/jdk/include/linux Located all JNI components successfully. -- Found PkgConfig: /usr/bin/pkg-config (found version "0.23")  -- checking for module 'fuse' --   package 'fuse' not found -- Failed to find Linux FUSE libraries or include files.  Will not build FUSE client. -- Configuring done -- Generating done -- Build files have been written to: /data/hadoop-2.7.1-src/hadoop-hdfs-project/hadoop-hdfs/src 接下来就可以执行make来编译生成libhdfs.a了。

    02

    ntfs-3g 集成

    ntfs-3g 集成 1. 下载 http://www.tuxera.com/community/ntfs-3g-download/ ntfs-3g-2010.8.8 2. 建立makefile a. 参考gstreamer/makefile    大概把 gstreamer改成ntfs_3g和ntfs-3g,GSTREAMER改成NTFS_3G,设置版本,源码包等。 b. 定义option_configure_args c. 取消install过程 根据需要确定是否--enable-debug 3. 编译 $make -C src/thirdparty/ntfs-3g/ remove 在Huangpu/makefile下面加入对ntfs-3g的编译目标,然后$make ntfs-3g 4. 运行 a. 把编译的结果mount到机顶盒 pc: #ln -s /home/qianjiang/apollo/sw/ga300/target/output/objs/summit-dualhd-gnu-4.4.0-linux-debug/comps/generic_apps/ ~/nfsroot/apps apollo: # mount -t nfs -o rw,tcp,nolock,nfsvers=3 192.168.2.2:/home/qianjiang/nfsroot/apps mnt/apps/ b. 把目标文件拷贝到/bin和/lib下面 # cp mnt/apps/ntfs-3g/ntfs-3g-2010.8.8/libntfs-3g/.libs/libntfs-3g.so* /lib/ # cp mnt/apps/ntfs-3g/ntfs-3g-2010.8.8/src/.libs/ntfs-3g /bin/ # ntfs-3g --help 注意: 曾经运行src下面的ntfs-3g得到异常的问题: # /mnt/apps/ntfs-3g/ntfs-3g-2010.8.8/src/ntfs-3g -/bin/sh: /mnt/apps/ntfs-3g/ntfs-3g-2010.8.8/src/ntfs-3g: not found 网上说可能是相关库文件找不到,应该拷贝至/lib或者设置LD_LIBRARY_PATH,但是都未奏效。而且pc下运行也没问题,ldd ntfs-3g表明是无动态链接库。所以,很奇怪! 5. 调试 # ntfs-3g /dev/sda4 mnt/sda/ modprobe: module 'fuse' not found ntfs-3g-mount: fuse device is missing, try 'modprobe fuse' as root 注: 曾经可没有这么好的出现提示,而是死机,,,所以。。。 6. 加入fuse 6.1 pc #cd target/src/sd/os/oslinux/comps/kernel/linux-2.6.28.10/ #cp target/output/objs/pnx8473_hirf_moca_mp1_mtd_debug/.config ./ #make menuconfig => 选中fuse文件系统 #make modules #cp fs/fuse/fuse.ko /home/qianjiang/nfsroot/appfs/lib/modules/2.6.28.10/extra/ 注:这里对kernel的编译可能不是Official的方式。 6.2 apollo #insmod fuse.ko 7. 测试 7.1写测试 ==> OK 7.2性能测试 ===> 写hello.sh date cp mnt/sda/GA300_full_src.tar.gz mnt/sda/GA300_full_src.tar.gz1 umount mnt/sda date # sh hello.sh Wed Dec 31 17:06:19 MST 1969 Unmounting /dev/sda4 () Wed Dec 31 17:19:44 MST 1969 (read + write)bs = 1608602770(file size) * 8 / 805(time) = 15.3Mbits/s 8. 集成和check in 8.1 file: pnx8473_hirf_moca_mp1_mtd_debug_defconfig     enable fuse 8.2 Huangpu/makefile     add make target: ntfs-3g

    03

    sshfs 文件系统权限的一点笔记

    sshfs 是基于ssh的一个工具,用于挂载远端的文件系统到本地. 只要可以用ssh方式访问远端,那么就可以用sshfs 这个工具把有权限的目录挂载到本地来. 在linux系统中,有一个虚拟文件系统的概念,虚拟文件系统作为一个统一的文件系统接口,各种不同的文件系统的驱动只要实现虚拟文件系统接口就可以了,而驱动一般都不会运行在用户空间,而为了在用户空间也可以export 一个虚拟文件系统接口,fuse 这个工具就被创造出来了. fuse 就是实现用户空间export 出一个虚拟文件系统的接口. 基于fuse , sshfs 这个工具才可以很好的工作, mount时候指定的filesystem 类型就是fuse , 而一旦mount 之后,用df 看到的文件系统类型则是: fuse.sshfs .

    03

    Linux上编译hadoop-2.7.1的libhdfs.so和libhdfs.a

    hadoop提供了CMake来编译libhdfs,因此在编译之前需要先安装好CMake工具。 然后进入libhdfs的源代码目录,如:/data/hadoop-2.7.1-src/hadoop-hdfs-project/hadoop-hdfs/src 执行cmake以生成Makefile文件(假设jdk的安装目录为/data/jdk1.7.0_55): cmake -DGENERATED_JAVAH=/data/jdk1.7.0_55 -DJAVA_HOME=/data/jdk1.7.0_55 . 成功之后,会在目录下生成Makefile文件,接下来就可以执行make编译生成libhdfs.so和libhdfs.a了。 如果遇到下面这样的错误: /data/jdk1.7.0_55/jre/lib/amd64/server/libjvm.so: file not recognized: File format not recognized 则需要考虑升级链接器ld,参考说明:http://blog.chinaunix.net/uid-20682147-id-4239779.html。 ld是GNU binutils的成员,可以从http://ftp.gnu.org/gnu/binutils/下载到新的版本。 注意在升级gcc和ld之后,需要更新下环境变量PATH,再重执行cmake,否则可能引用的仍然是老版本的gcc和ld。 /data/hadoop-2.7.1-src/hadoop-hdfs-project/hadoop-hdfs/src # cmake -DGENERATED_JAVAH=/data/java_1_7 -DJAVA_HOME=/data/java_1_7 -- The C compiler identification is GNU 4.1.2 -- The CXX compiler identification is GNU 4.1.2 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done JAVA_HOME=/data/java_1_7, JAVA_JVM_LIBRARY=/data/java_1_7/jre/lib/amd64/server/libjvm.so JAVA_INCLUDE_PATH=/data/java_1_7/include, JAVA_INCLUDE_PATH2=/data/java_1_7/include/linux Located all JNI components successfully. -- Performing Test HAVE_BETTER_TLS -- Performing Test HAVE_BETTER_TLS - Success -- Performing Test HAVE_INTEL_SSE_INTRINSICS -- Performing Test HAVE_INTEL_SSE_INTRINSICS - Success -- Looking for dlopen in dl -- Looking for dlopen in dl - found -- Found JNI: /data/java_1_7/jre/lib/amd64/libjawt.so   -- Found PkgConfig: /usr/bin/pkg-config (found version "0.20")  -- checking for module 'fuse' --   package 'fuse' not found

    02

    Why does FUSE on Android suck?

    Introduction FUSE (Filesystem in Userspace) is a very useful mechanism in many applications. The thing is, those applications should not be focused on performance in terms of actual data transfers. FUSE has many advantages implied by userspace sandboxing, but for sure performance wasn't the main design consideration. I'm not telling that it is a bad design or something wrong with FUSE itself. It is just focused on other aspects like security, stability and easiness of creating applications. The problem I'd like to discuss here is that Google decided to use FUSE as a frontend to actual data stored on the non-volatile memory. FUSE has been introduced in Android 4.4 to handle "emulated" storage. Before that, "emulated" storage path was mounted as VFAT. Here's how it looked on old ICS (output of mount command):

    01
    领券