在android中执行 命令mount

文件系统的分类介绍原文链接
linux mount命令详解原文链接

该代码在荣耀1上进行的测试,后来在三星的机子上测试发现结果会有不同,因此在不同机子上会有不同的效果

   List<String> list = new ArrayList<>();
        InputStream is = null;
        InputStreamReader isr = null;
        BufferedReader br = null;

        try{
            Runtime runtime = Runtime.getRuntime();
            Process process = runtime.exec("mount");
            is = process.getInputStream();
            isr = new InputStreamReader(is);
            br = new BufferedReader(isr);
            String line ;
            while((line = br.readLine())!=null){
                Log.e("StorageUtil",line);
                String result[] = line.split(" ");
                line = result[0];
                File file = new File(line);
                if(file.isDirectory()){
                    list.add(line);
                }
            }
            if(is!=null){
                is.close();
            }
            if(isr!=null){
                isr.close();
            }
            if(br!=null){
                br.close();
            }

       }catch (Exception e){
              e.printStackTrace();
       }finally {

       }
09-13 22:17:12.600  28504-28504/com.lyp.idcard E/StorageUtil﹕ rootfs / rootfs ro,relatime 0 0
09-13 22:17:12.602  28504-28504/com.lyp.idcard E/StorageUtil﹕ tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
09-13 22:17:12.604  28504-28504/com.lyp.idcard E/StorageUtil﹕ devpts /dev/pts devpts rw,relatime,mode=600 0 0
09-13 22:17:12.604  28504-28504/com.lyp.idcard E/StorageUtil﹕ none /dev/cpuctl cgroup rw,relatime,cpu 0 0
09-13 22:17:12.605  28504-28504/com.lyp.idcard E/StorageUtil﹕ proc /proc proc rw,relatime 0 0
09-13 22:17:12.606  28504-28504/com.lyp.idcard E/StorageUtil﹕ sysfs /sys sysfs rw,relatime 0 0
09-13 22:17:12.606  28504-28504/com.lyp.idcard E/StorageUtil﹕ none /acct cgroup rw,relatime,cpuacct 0 0
09-13 22:17:12.608  28504-28504/com.lyp.idcard E/StorageUtil﹕ tmpfs /mnt/secure tmpfs rw,relatime,mode=700 0 0
09-13 22:17:12.608  28504-28504/com.lyp.idcard E/StorageUtil﹕ tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
09-13 22:17:12.609  28504-28504/com.lyp.idcard E/StorageUtil﹕ /dev/block/dm-0 /mnt/asec/com.lyp.idcard-1 ext4 ro,dirsync,nosuid,nodev,noatime 0 0
09-13 22:17:12.610  28504-28504/com.lyp.idcard E/StorageUtil﹕ tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
09-13 22:17:12.613  28504-28504/com.lyp.idcard E/StorageUtil﹕ tmpfs /storage/emulated tmpfs rw,relatime,mode=705,uid=1023,gid=1023 0 0
09-13 22:17:12.613  28504-28504/com.lyp.idcard E/StorageUtil﹕ tmpfs /storage/emulated tmpfs rw,nosuid,nodev,relatime,mode=050,gid=1028 0 0
09-13 22:17:12.613  28504-28504/com.lyp.idcard E/StorageUtil﹕ emmc@cust /cust ext4 ro,noatime,data=ordered 0 0
09-13 22:17:12.613  28504-28504/com.lyp.idcard E/StorageUtil﹕ /emmc@android /system ext4 ro,noatime,noauto_da_alloc,commit=1,data=ordered 0 0
09-13 22:17:12.614  28504-28504/com.lyp.idcard E/StorageUtil﹕ /emmc@usrdata /data ext4 rw,nosuid,nodev,noatime,noauto_da_alloc,data=ordered 0 0
09-13 22:17:12.614  28504-28504/com.lyp.idcard E/StorageUtil﹕ tmpfs /data/local_neighbour tmpfs rw,nodev,noatime,nodiratime,size=10240k,mode=755 0 0
09-13 22:17:12.614  28504-28504/com.lyp.idcard E/StorageUtil﹕ /emmc@cache /cache ext4 rw,nosuid,nodev,noatime,noauto_da_alloc,data=ordered 0 0
09-13 22:17:12.614  28504-28504/com.lyp.idcard E/StorageUtil﹕ /emmc@protect_f /protect_f ext4 rw,nosuid,nodev,noatime,nodelalloc,noauto_da_alloc,commit=1,data=ordered 0 0
09-13 22:17:12.614  28504-28504/com.lyp.idcard E/StorageUtil﹕ /emmc@protect_s /protect_s ext4 rw,nosuid,nodev,noatime,nodelalloc,noauto_da_alloc,commit=1,data=ordered 0 0
09-13 22:17:12.614  28504-28504/com.lyp.idcard E/StorageUtil﹕ /dev/block/loop0 /mnt/cd-rom iso9660 ro,relatime 0 0
09-13 22:17:12.614  28504-28504/com.lyp.idcard E/StorageUtil﹕ /dev/fuse /mnt/shell/emulated fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
09-13 22:17:12.615  28504-28504/com.lyp.idcard E/StorageUtil﹕ /dev/block/vold/179:97 /storage/sdcard1 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
09-13 22:17:12.615  28504-28504/com.lyp.idcard E/StorageUtil﹕ tmpfs /storage/sdcard1/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
09-13 22:17:12.615  28504-28504/com.lyp.idcard E/StorageUtil﹕ /dev/fuse /storage/emulated/0 fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
09-13 22:17:12.615  28504-28504/com.lyp.idcard E/StorageUtil﹕ /dev/fuse /storage/emulated/0/Android/obb fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
09-13 22:17:12.615  28504-28504/com.lyp.idcard E/StorageUtil﹕ /dev/fuse /storage/emulated/legacy fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
09-13 22:17:12.615  28504-28504/com.lyp.idcard E/StorageUtil﹕ /dev/fuse /storage/emulated/legacy/Android/obb fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
centos 挂载ntfs所需要的步骤 我就是在挂载2TB的时候发现的 linux挂载NTFS分区移动硬盘2010-09-23 16:35CentOS 挂载NTFS分区移动硬盘 1.uname -r 查看当前的linux内核版本. [root@localhost Desktop]# uname -r 2.6.18-128.el5 2.去http://www.linux-ntfs.org/下载与内核版本相同的ntfs补丁.具体的地址 3.安装补丁:kernel-module-ntfs-2.6.18-128.el5-2.1.27-0.rr.10.11.i686.rpm [root@localhost Desktop]# rpm -ivh kernel-module-ntfs-2.6.18-128.el5-2.1.27-0.rr.10.11.i686.rpm Preparing... ########################################### [100%] 1:kernel-module-ntfs-2.6.########################################### [100%] 4.使用fdisk -l查看硬盘的分区信息. 5.mkdir /mnt/xxx 在mnt文件夹里新建文件夹,分别对应于移动硬盘下的分区(xxx为文文件夹名) 如:mkdir /mnt/name1 对应于叫做name1的盘 6.mount -t ntfs /dev/sdyz /mnt/xxx 将移动硬盘下的各分区挂载在新建的文件夹里(sdyz为硬盘的分区号码) 如: [root@localhost Desktop]# mount -t ntfs /dev/sdc1 /mnt/TheLORD,OurGod 今天将USB移动硬盘挂在CentOS上准备将压缩包拷贝下来的。 结果挂载移动硬盘的时候却提示: mount: unknown filesystem type ‘ntfs’ 原因:Linux无法识别NTFS格式的分区。 解决: 因为刚刚将CentOS升级到了2.6.18-164.el5内核,无法使用Kernel NTFS Module挂载Windows下的NTFS分区(没有在开源站点上找到相应内核包),所以只有使用ntfs-3g来解决了。 打开ntfs-3g的下载站点,将最新稳定版(当前最新版本为ntfs-3g-2010.3.6)下载到CentOS,执行以下命令安装: 1、编译安装ntfs-3g: #./configure #make #make install [/code] 2、查看USB设备点: #fdisk -l Disk /dev/sdb: 60.0 GB, 60011642880 bytes 255 heads, 63 sectors/track, 7296 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 * 1 653 5245191 b W95 FAT32 /dev/sdb2 654 7295 53351865 f W95 Ext'd (LBA) /dev/sdb5 654 1958 10482381 b W95 FAT32 /dev/sdb6 1959 7295 42869421 7 HPFS/NTFS 3、挂载NTFS分区: #mount -t ntfs-3g /dev/sdb6 /mnt/win
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值