dmsetup remove dm device solve : zpool error:one or more vdevs refer to the same device

简介:
这是一个OCZ的SSD, 一般用一半以内的容量是性能比较好, 所以480G的SSD, 我分了220G给ZFS缓存.
但是注意对其的问题.
# fdisk -c -u /dev/sda

开始位置2048
新增块数2048*1024*220-1=461373439
因为原来配置的块未对其, 所以准备重新分一下 : 
查看cache设备 :
# zpool status
  pool: zp1
 state: ONLINE
  scan: none requested
config:

        NAME                                            STATE     READ WRITE CKSUM
        zp1                                             ONLINE       0     0     0
          mirror-0                                      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2c8a06200099      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2c92069983cb      ONLINE       0     0     0
          mirror-1                                      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2c9a0712503c      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2ca2078b4231      ONLINE       0     0     0
          mirror-2                                      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2ca907f2b840      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2cb0085a22e6      ONLINE       0     0     0
          mirror-3                                      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2cba08f37c32      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2d340486b1c4      ONLINE       0     0     0
          mirror-4                                      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2d3b04e93404      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2d42054f21b8      ONLINE       0     0     0
          mirror-5                                      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2d4905bed3f3      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2d4f061c3f88      ONLINE       0     0     0
        logs
          wwn-0x6b083fe0d17216001c1b2c7f056bd76c-part3  ONLINE       0     0     0
        cache
          wwn-0x5e83a977e08cba3e-part1                  ONLINE       0     0     0

删除cache设备
# zpool remove zp1 wwn-0x5e83a977e08cba3e-part1

重新对ssd分区 : 
# fdisk -c -u /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xb641c765.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First sector (2048-937766396, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-937766396, default 937766396): +461373439

重新分完, 添加回去报错
# zpool add zp1 cache /dev/disk/by-id/wwn-0x5e83a977e08cba3e-part1
cannot open '/dev/disk/by-id/wwn-0x5e83a977e08cba3e-part1': Device or resource busy
cannot add to 'zp1': one or more vdevs refer to the same device


dd 这个设备亦无变化, 一开始我以为是头信息的问题 : 
# dd if=/dev/zero of=/dev/disk/by-id/wwn-0x5e83a977e08cba3e-part1 bs=1k count=1024

# zpool add zp1 cache /dev/disk/by-id/wwn-0x5e83a977e08cba3e-part1
cannot open '/dev/disk/by-id/wwn-0x5e83a977e08cba3e-part1': Device or resource busy
cannot add to 'zp1': one or more vdevs refer to the same device


真实原因是这个设备被device mapper占用了.
# dmsetup  ls
sda1    (253:0)


删除这个dm设备 : 
# dmsetup remove /dev/disk/by-id/dm-name-sda1

ata-OCZ-REVODRIVE3_X2_OCZ-9XJBU029CT3M3U56           scsi-SATA_OCZ-REVODRIVE3_OCZ-9XJBU029CT3M3U56
ata-OCZ-REVODRIVE3_X2_OCZ-9XJBU029CT3M3U56-part1     scsi-SATA_OCZ-REVODRIVE3_OCZ-9XJBU029CT3M3U56-part1
dm-name-sda1                                         wwn-0x5e83a977e08cba3e
dm-uuid-part1-sda


现在添加cache成功了, 省去了重启的烦恼.
# zpool add zp1 cache /dev/disk/by-id/wwn-0x5e83a977e08cba3e-part1

# zpool status
  pool: zp1
 state: ONLINE
  scan: none requested
config:

        NAME                                            STATE     READ WRITE CKSUM
        zp1                                             ONLINE       0     0     0
          mirror-0                                      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2c8a06200099      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2c92069983cb      ONLINE       0     0     0
          mirror-1                                      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2c9a0712503c      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2ca2078b4231      ONLINE       0     0     0
          mirror-2                                      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2ca907f2b840      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2cb0085a22e6      ONLINE       0     0     0
          mirror-3                                      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2cba08f37c32      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2d340486b1c4      ONLINE       0     0     0
          mirror-4                                      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2d3b04e93404      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2d42054f21b8      ONLINE       0     0     0
          mirror-5                                      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2d4905bed3f3      ONLINE       0     0     0
            wwn-0x6b083fe0d17216001c1b2d4f061c3f88      ONLINE       0     0     0
        logs
          wwn-0x6b083fe0d17216001c1b2c7f056bd76c-part3  ONLINE       0     0     0
        cache
          wwn-0x5e83a977e08cba3e-part1                  ONLINE       0     0     0

目录
相关文章
|
并行计算 Linux PyTorch
RuntimeError: CUDA error: device-side assert triggered
我在运行PyG和transformers代码时两次遇到了这一问题,在此加以记录。
|
6月前
|
Oracle 关系型数据库
Customer RecommendedORA-27090 - Unable to Reserve Kernel Resources for Asynchronous Disk I/O
Customer RecommendedORA-27090 - Unable to Reserve Kernel Resources for Asynchronous Disk I/O
49 4
|
6月前
|
机器学习/深度学习 并行计算 PyTorch
【已解决】RuntimeError: CUDA error: device-side assert triggeredCUDA kernel errors might be asynchronous
【已解决】RuntimeError: CUDA error: device-side assert triggeredCUDA kernel errors might be asynchronous
|
6月前
|
并行计算 PyTorch 算法框架/工具
【已解决】RuntimeError: CuDA error: no kernel image is available for execution on the device
【已解决】RuntimeError: CuDA error: no kernel image is available for execution on the device
|
虚拟化
成功解决Failed to execute stage ‘Setup validation’: Hardware does not support virtualization.
成功解决Failed to execute stage ‘Setup validation’: Hardware does not support virtualization.
|
6月前
|
Ubuntu iOS开发 MacOS
Could not enumerate video devices (or none found).解决办法
Could not enumerate video devices (or none found).解决办法
92 0
|
机器学习/深度学习 PyTorch 算法框架/工具
解决RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cp
对应两种保存模型的方式,pytorch也有两种加载模型的方式。对应第一种保存方式,加载模型时通过torch.load(‘.pth’)直接初始化新的神经网络对象;对应第二种保存方式,需要首先导入对应的网络,再通过net.load_state_dict(torch.load(‘.pth’))完成模型参数的加载。
1638 0
|
C语言
解决Dev-C++ [Error] ‘for‘ loop initial declarations are only allowed in C99 or C11 mode
Dev-C++ [Error] ‘for‘ loop initial declarations are only allowed in C99 or C11 mode
749 0
解决Dev-C++ [Error] ‘for‘ loop initial declarations are only allowed in C99 or C11 mode
|
Java Apache
Failed to place enough replicas
如果DataNode的dfs.datanode.data.dir全配置成SSD类型,则执行“hdfs dfs -put /etc/hosts hdfs:///tmp/”时会报如下错误: 2017-05-04 16:08:22,545 WARN org.
3296 0