Não é possível formatar o disco com o comando mkfs no CentOS 7

1

Seguiu este guia para adicionar um novo disco:

link

Isso se tornou /dev/sdb .

Após executar fdisk /dev/sdb para fazer a partição. Verifique novamente:

fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト
Disk label type: dos
ディスク識別子: 0x000cd479

デバイス ブート      始点        終点     ブロック   Id  システム
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200    20971519     9436160   8e  Linux LVM

Disk /dev/mapper/cl-root: 8585 MB, 8585740288 bytes, 16769024 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト


Disk /dev/mapper/cl-swap: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト


Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト
Disk label type: dos
ディスク識別子: 0xa267f022

デバイス ブート      始点        終点     ブロック   Id  システム
/dev/sdb1            2048     4194303     2096128   83  Linux

O Device boot tem /dev/sdb1 .

Mas execute mkfs.ext4 /dev/sdb1 para formatá-lo e receba este erro:

mke2fs 1.42.9 (28-Dec-2013)
/dev/sdb1 is apparently in use by the system; will not make a filesystem here!

Por quê? Não pode formatá-lo? Eu quero usar /dev/sdb , mas talvez primeiro deve formatar /dev/sdb1 . Agora não posso.

Editar

Executar lsblk

NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0   10G  0 disk
├─sda1        8:1    0    1G  0 part /boot
└─sda2        8:2    0    9G  0 part
  ├─cl-root 253:0    0    8G  0 lvm  /
  └─cl-swap 253:1    0    1G  0 lvm  [SWAP]
sdb           8:32   0   16G  0 disk
sr0          11:0    1 1024M  0 rom
drbd0       147:0    0    2G  0 disk

Executar lsof /dev/sdb1

Não retornou nada.

Executar ls -l /sys/class/block/sdb1/holders

Total: 0

Executar pvs

PV         VG Fmt  Attr PSize PFree
/dev/sda2  cl lvm2 a--  9.00g    0

Executar lvmdiskscan

  /dev/cl/root [       8.00 GiB]
  /dev/sda1    [       1.00 GiB]
  /dev/cl/swap [       1.00 GiB]
  /dev/sda2    [       9.00 GiB] LVM physical volume
  /dev/sdb1    [       2.00 GiB]
  2 disks
  2 partitions
  0 LVM physical volume whole disks
  1 LVM physical volume

Executar mount

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=931116k,nr_inodes=232779,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_prio,net_cls)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/mapper/cl-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=31,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
/dev/sda1 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=188416k,mode=700)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)

Editar 2

Executar mkfs.ext4 -F /dev/sdb1

mke2fs 1.42.9 (28-Dec-2013)
/dev/sdb1 is apparently in use by the system; will not make a filesystem here!

Executar umount /dev/sdb1

umount: /dev/sdb1: not mounted

Um recurso

    
por cloud_cloud 20.07.2017 / 08:54

1 resposta

1
$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
...
sdb           8:16   0    2G  0 disk
├─sdb1        8:17   0    2G  0 part
└─drbd0     147:0    0    2G  1 disk
...

I am doing the drbd test now. So need to add a new hard disk and partition/format now.

Você está fazendo errado então!

Nunca grave no dispositivo subjacente ( sdb ) depois de criar drbd0 . Escreva para drbd0 . Isso também resolveria o problema na questão.

Neste ponto, eu destruiria o drbd0 e o recriaria.

    
por 21.07.2017 / 08:55

Tags