mount

nfs 支持ipv6

牧云@^-^@ 提交于 2019-11-29 06:51:48
mount 一个ipv6 nfs 项目在docker里mount 一个nfs来读写,而现在需要支持ipv6,所以先写了各小demo,最后成功mount,这里记录一下 #include <sys/mount.h> #include <errno.h> #include <stdio.h> int main(){ const char* src = "[2001:db8:1::1]:/root/nfsshare/zone1"; const char* opt = "addr=2001:db8:1::1,clientaddr=2001:db8:1::242:ac11:3"; const char* des = "/mnt"; int ret = mount(src,des,"nfs4",0,opt); if(ret != 0){ perror("mount"); } } 说明: addr=2001:db8:1::1 是服务端地址 clientaddr=2001:db8:1::242:ac11:3 是客户端地址 解决思路 先确保了网络连通,这里的server 地址实际是在主机中看到的docker0的地址,nfs server监听在所有的地址上 在bash中使用mont 命令成功mount 使用strace 追踪mount 命令,然后看到系统调用mount 的参数,也就是我们需要的参数了

Linux常用命令(八)

风格不统一 提交于 2019-11-29 04:13:59
挂载命令 1、mount:查看所有挂载的盘符 2、mount -a:挂载所有的盘符,由于Linux开机就已经直接将所有的系统盘符挂载了,所以执行这条命令不会有什么效果 3、mount [-t 文件系统] [-o 特殊选项] 设备文件名 挂载点 选项:   -t 文件系统:加入文件系统类型来指定挂载的类型,可以ext3、ext4、iso9660(默认的光盘挂载文件系统类型是iso9660,同时光盘的设备文件名是/dev/sr0,写成/dev/cdrom也行)   -o 特殊选项:可以指定挂载的额外选项(remount重新挂载,exec可在挂载文件系统下执行可执行文件,noexec不可在挂载文件系统下执行可执行文件) 4、umount 设备文件名或者挂载点:卸载命令,只要是设备文件名或者挂载点其中一个就行,但是不能跟两个,这样第二次卸载的时候就会出问题 5、fdisk -l:识别出系统中已经挂载的U盘,即查看U盘设备文件名 6、mount -t vfat /dev/sdb1 /mnt/usb:挂载U盘,/dev/sdb1是上一条命令识别出来的 小提示: 1、为什么Linux开机就已经将所有的盘符挂载了呢? 原因:在/etc/fstab文件中,写的是所有开机即挂载的盘符,而像我们在安装的时候已经创建的挂载的盘符就写在这个文件里面,所以它们开机自动挂载 2、既然能将需要挂载的盘符写在

Cannot change android system directory to rw

一笑奈何 提交于 2019-11-29 04:13:10
I am trying to remount the /system as a rw file system so I can push some files into /system/framework. It is an android emulator running Android 6.0 x86 image. $ mount ... /dev/block/vda /system ext4 ro,seclabel,relatime,data=ordered 0 0 ... Then I do su mount -o rw,remount /system mount ... /dev/block/vda /system ext4 rw,seclabel,relatime,data=ordered 0 0 ... At this time I am thinking I am ok. Then I am doing on host: adb push test.jar /system/framework/ However I see: failed to copy 'test.jar' to '/system/framework/test.jar': Read-only file system Then I go back to adb: mount ... /dev

Linux常见故障及修复方法

别来无恙 提交于 2019-11-29 01:56:08
一:MBR扇区故障修复 【root@www~】#mkdir /backup 【root@www~】#mount /dev/sdb1 /backup / ##新建个硬盘分区,并挂载到新建文件夹内 【root@www~】#dd if=/dev/sda of=/backup/sda.mbr.bak bs=512 count=1 ##备份MBR扇区512字节 【root@www~】#dd if=/dev/zero of=/dev/sda bs=512 count=1 ##往MBR扇区内覆盖,模拟MBR故障 【root@www~】#reboot //提前设置光盘引导重启 进入紧急救援模式 Bash-4.1#mkdir /backup ##挂载点名字可以随便起名,不做要求 Bash-4.1#mount /dev/sdb1 /backup ##因为sda 是内核启动的地方无法读取 Bash-4.1#ls /backup Lost+found sda.mbr.bak Bash-4.1#dd if=/backup/sda.mbr.bak of=/dev/sda bs=512 count=1 ##写入扇区,完成修复 Bash-4.1#reboot 二.GRUB引导故障 1.MBR中的grub引导程序遭到丢失,重启显示“grub>”提示符 方法一:尝试手动输入(不建议) 【root@www~】

文件系统

*爱你&永不变心* 提交于 2019-11-29 00:40:29
==什么是文件系统? 计算机的文件系统是一种存储和组织数据的方法,文件系统使用文件和树形目录的抽象逻辑 概念代替了硬盘和光盘等物理设备使用数据块的概念 文件系统通常使用硬盘和光盘这样的存储设备,并维护文件在设备中的物理位置。 实际上文件系统也可能仅仅是一种访问数据的界面而已,实际的数据是通过网络协议 (如NFS、SMB、9P等)提供的或者内存上,甚至可能根本没有对应的文件(如proc文件系统) ==什么是数据块? 块是一段标准长度(块大小)的字节或位元,一般为512字节或1024字节,又称为簇,是管理 存储的最小单元,一般一次会读取一个完整的块 ==文件系统类型有哪些? 磁盘支持类型:FAT、exFAT、NTFS、HFS、HFS+、ext2、ext3、ext4、ODS-5、btrfs、XFS、UFS、ZFS。 linux支持类型:Btrfs、JFS、ReiserFS、exFAT、ext、ext2、ext3、ext4、XFS、ISO 9660、 Minix、MSDOS、UMSDOS、VFAT、NTFS(Linux Kernel内置的NTFS驱动程序,写入功能不稳定)、 HPFS、NFS、SMB、SysV、PROC等 Windows支持类型:FAT12/FAT16 FAT32/VFAT FAT64/exFAT NTFS ==不同的文件系统类型,怎么访问? vfs虚拟文件系统

Docker数据卷

眉间皱痕 提交于 2019-11-29 00:29:45
Docker 数据卷 数据卷 是一个可供一个或多个容器使用的特殊目录,它绕过 UFS,可以提供很多有用的特性: 数据卷 可以在容器之间共享和重用 对 数据卷 的修改会立马生效 对 数据卷 的更新,不会影响镜像 数据卷 默认会一直存在,即使容器被删除 注意:数据卷 的使用,类似于 Linux 下对目录或文件进行 mount,镜像中的被指定为挂载点的目录中的文件会隐藏掉,能显示看的是挂载的 数据卷。 选择 -v 还是 -–mount 参数 Docker 新用户应该选择 --mount 参数,经验丰富的 Docker 使用者对 -v 或者 --volume 已经很熟悉了,但是推荐使用 --mount 参数。 创建一个数据卷 docker volume create holyman 查看所有的 数据卷 docker volume ls local holyman 在主机里使用以下命令可以查看指定 数据卷 的信息 docker volume inspect holyman [ { "Driver": "local", "Labels": {}, "Mountpoint": "/var/lib/docker/volumes/holyman/_data", "Name": "holyman", "Options": {}, "Scope": "local" }] 启动一个挂载数据卷的容器 在用

Android: how to mount filesystem in RW from within my APK? (rooted, of course)

佐手、 提交于 2019-11-29 00:21:30
I'm trying to write an app that copies something to the /system partition at run time. I've already implemented the ability to run terminal commands as root by requesting SU permissions. I can run a lot of commands successfully (after granting the permission request with SuperUser). However, when I try to remount /system as read/write, nothing happens. I don't get an error or a crash, and the command seems to go through just fine, but the partition stays as read-only. Here's the command I'm running (Droid X): mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system , and it works just fine if

Where is a file mounted?

≯℡__Kan透↙ 提交于 2019-11-28 18:19:54
Given a path to a file or directory, how can I determine the mount point for that file? For example, if /tmp is mounted as a tmpfs filesystem then given the file name /tmp/foo/bar I want to know that it's stored on a tmpfs rooted at /tmp . This will be in C++ and I'd like to avoid invoking external commands via system() . The code should be robust--not necessarily against deliberate tampering but definitely in the face of nested mountpoints, symlinks, etc. I haven't been able to find a simple system call to do this. It looks like I'll have to write the check myself. Here's a rough outline of

FUSE error: Transport endpoint is not connected

痴心易碎 提交于 2019-11-28 16:38:38
问题 I'm trying to implement the FUSE filesystem. I am receiving this error: cannot access MountDir: Transport endpoint is not connected This the relevant parts of the program. There are two directories, MirrorDir and MountDir , that exist withing the same directory as all of the code. I am calling the program like this: ./myFS -o nonempty -o allow_other MirrorDir MountDir Can anyone see what I am doing wrong? static struct fuse_operations xmp_oper = { .getattr = xmp_getattr, .readdir = xmp