简体   繁体   English

挂载docker逻辑卷

[英]Mount docker logical volume

I'm trying to access to a logical volume where previously was used by docker.我正在尝试访问以前由 docker 使用的逻辑卷。 This is the result of various command:这是各种命令的结果:

lsblk lsblk

NAME                          MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1                       259:2    0  80G  0 disk
├─nvme0n1p1                   259:3    0  80G  0 part /
└─nvme0n1p128                 259:4    0   1M  0 part
nvme1n1                       259:0    0  80G  0 disk
└─nvme1n1p1                   259:1    0  80G  0 part
  ├─docker-docker--pool_tdata 253:1    0  79G  0 lvm
  │ └─docker-docker--pool     253:2    0  79G  0 lvm
  └─docker-docker--pool_tmeta 253:0    0  84M  0 lvm
    └─docker-docker--pool     253:2    0  79G  0 lvm

fdisk磁盘

Disk /dev/nvme1n1: 85.9 GB, 85899345920 bytes, 167772160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00029c01

        Device Boot      Start         End      Blocks   Id  System
/dev/nvme1n1p1            2048   167772159    83885056   8e  Linux LVM
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/nvme0n1: 85.9 GB, 85899345920 bytes, 167772160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 358A5F86-3BCA-4FB2-8C00-722B915A71AB


#         Start          End    Size  Type            Name
 1         4096    167772126     80G  Linux filesyste Linux
128         2048         4095      1M  BIOS boot       BIOS Boot Partition

lvdisplay显示

  --- Logical volume ---
  LV Name                docker-pool
  VG Name                docker
  LV UUID                piD2Wx-aDjf-CkpN-b4s4-YXWE-6ERm-GWTcOz
  LV Write Access        read/write
  LV Creation host, time ip-172-31-39-159, 2020-02-16 09:18:57 +0000
  LV Pool metadata       docker-pool_tmeta
  LV Pool data           docker-pool_tdata
  LV Status              available
  # open                 0
  LV Size                79.03 GiB
  Allocated pool data    80.07%
  Allocated metadata     31.58%
  Current LE             20232
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

But when I try to mount the volume docker-docker--pool_tdata I get the following error:但是当我尝试挂载卷docker-docker--pool_tdata我收到以下错误:

mount  /dev/mapper/docker-docker--pool_tdata /mnt/test
mount: /dev/mapper/docker-docker--pool_tdata is already mounted or /mnt/test busy

I've also tried to reboot the machine, to uninstall docker and to see if there is file opened on that volume using lsof我还尝试重新启动机器,卸载 docker 并使用lsof查看该卷上是否打开了文件

Do you have any clue about how can I mount that volume?你对我如何挂载该卷有任何线索吗? Thanks谢谢

Try a lsof on it to see which process has locks on it as a start.对它尝试 lsof 以查看哪个进程在开始时锁定了它。 Then see if you can stop that process.然后看看您是否可以停止该过程。

Uninstalling docker does not really help as purge and autoremove only delete the installed packages and not the images, containers, volumes and config files.卸载autoremove并没有真正的帮助,因为purgeautoremove删除只会删除已安装的包,而不是图像、容器、卷和配置文件。

To delete those you have to delete a bunch of directories contained in etc , var/lib , bin and var/run要删除那些你必须删除包含在etcvar/libbinvar/run的一堆目录

  1. Clean up the env清理环境

try running docker system prune -a to remove unused containers, images etc remove the volume with docker volume rm {volumeID} create the volume again docker volume create docker-docker--pool_tdata尝试运行docker system prune -a删除未使用的容器、图像等删除卷docker volume rm {volumeID}再次创建卷docker volume rm {volumeID} docker volume create docker-docker--pool_tdata

  1. Kill the process杀死进程

run lsof +D /mnt/test or cat ../docker/../tasks this should display the PIDs of alive tasks.运行lsof +D /mnt/testcat ../docker/../tasks这应该显示活动任务的 PID。

Kill the task with kill -9 {PID}kill -9 {PID}终止任务

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM