type kpartx >/dev/null 2>&1; then apt update apt install -y kpartx fi # add to /dev/loop loop=`losetup -f` losetup $loop disk.raw kpartx -av $loop # mount loop0p1 to /mnt mount /dev/mapper/loop0p1 /mnt
命令可以查看使用的loop设备的关联情况 关联命令为 losetup /dev/loop0 /root/win2003.img 关闭关联命令为 losetup -d /dev/loop0 2 使用kpartx 命令将映射分区 kpartx -av /dev/loop0 参数-a 表示添加映射关系,-v表示显示映射的对应关系 映射成功的设备在/dev/mapper下面,比如/dev/mapper/ configuer make make install mount -t ntfs-3g /dev/mapper/loop0p1 /mnt 完成后依次关闭 umount /mnt kpartx
virtual.img # 如果提示设备忙你也可以使用其它的回环设备,"ls /dev/loop*"参看所有回环设备 # 解除设备关联 $ sudo losetup -d /dev/loop0 6 kpartx 为各分区建立虚拟设备的映射 $ sudo apt-get install kpartx $ sudo kpartx -av /dev/loop0 # 取消映射 $ sudo kpartx -dv /
apt-get install dosfstools sudo apt-get install dump sudo apt-get install parted sudo apt-get install kpartx 挂载虚拟磁盘并格式化 这个过程就是将 img 虚拟成 SD 卡一样,挂载到电脑,然后格式化它 1、首先建立虚拟磁盘并分区 sudo losetup /dev/loop0 lichee_zero.img sudo kpartx losetup -f 自动查找空闲的设备 sudo losetup -f 重新设置到找出的空闲设备上 sudo losetup /dev/loop21 lichee_zero.img sudo kpartx /rootfs/* /mnt/ # 内容拷贝 sudo umount /mnt # 卸载 六、卸载虚拟磁盘 sudo kpartx -d lichee_zero.img 七、dd 烧录系统 1、格式化
losetup /dev/loop0 /w2k8.img kpartx -av /dev/loop0 ntfsfix -b -d /dev/mapper/loop0p1 参数 -b -d非常重要! ntfsck /dev/mapper/loop0p1 kpartx -dv /dev/loop0 losetup -d /dev/loop0 四 如何挂载qcow2格式的镜像,一条命令搞定!
全量备份的访问方法 rbd在没有做快照的情况下的备份,导出后是一个文件形式的 rbd export testrbd testrbd 使用下面方法进行直接访问 losetup /dev/loop0 testrbd kpartx diff_from_BACKUPUTC20171024T191243 执行上面的以后会把快照的差量回滚到全量的那个备份当中 losetup /dev/loop0 testrbd\@BACKUPUTC20171024T190955.full kpartx
The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks
libpangomm-1.4-1v5 libsigc++-2.0-0v5 Suggested packages: xfsprogs reiserfsprogs reiser4progs jfsutils kpartx
The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) #reboot //重启系统
The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks
The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
连接设备后还需映射分区: sudo kpartx -va /dev/loop0 新的块设备在/dev/mapper目录下,这时候可以用mkfs进行格式化 sudo mkfs.vfat /dev/mapper
The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks
The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) 正在同步磁盘。
The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks
The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks
The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) 正在同步磁盘。
/partitions 有三个命令可以让内核重读磁盘分区表: CentOS 5: partprobe [DEVICE] CentOS 6,7: partx kpartx 命令: partx DEVICE partx -a DEVICE partx -a -n M:N DEVICE M M: :N kpartx 命令: kpartx -af DEVICE Linux文件系统管理 文件系统: VFS:Virtual File System Linux:ext2, ext3, ext4, reiserfs
The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) 2.
The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) 解决方式:实例重启或者reboot