如何让 Ubuntu 18.04.02 服务器版系统识别第二个磁盘?(df -h 和 lsblk 可以)

如何让 Ubuntu 18.04.02 服务器版系统识别第二个磁盘?(df -h 和 lsblk 可以)

我刚刚在一台具有两个磁盘的 PC 上安装了 Ubuntu 18.04.02 服务器版,并按照此处的指示进行操作:https://medium.com/@sh.tsang/partitioning-formatting-and-mounting-a-hard-drive-in-linux-ubuntu-18-04-324b7634d1e0 我对第二个磁盘进行了分区、格式化并挂载了 /dev/sdb

marco@pc:$ df -h
Filesystem               Size    Used   Avail  Use%  Mounted on
udev                     16G     0      16G    0%     /dev
tmpfs                    3.2G    1008K  3.2G   1%     /run
/dev/mapper/pc--vg-root  227G    1.9G   214G   1%     /
tmpfs                    16G     0      16G    0%     /dev/shm
tmpfs                    5.0M    0      5.0M   0%     /run/lock
/dev/sdb                 229G    61M    217G   1%     /mnt/sdb
/dev/sda1                511M    6.1M   505M   2%     /boot/efi
tmpfs                    3.2G    0      3.2G   0%     /run/user/1000

marco@pc:$ lsblk
NAME                     MAJ:MIN  RM  SIZE    RO   TYPE  MOUNTPOINT
sda                      8:0      0   232.9G  0    disk
  sda1                   8:1      0   512M    0    part  /boot/efi
  sda2                   8:2      0   232.4G  0    part
    pc--vg-root          253:0    0   231.4G  0    lvm   /
    pc--vg-wap_1         253:1    0   976M    9    lvm   [SWAP]
sdb                      8:16     0   232.9G  0    disk  /mnt/sdb
sr0                      11:0     1   1024M   0    rom

如果 df -h 和 lsblk 确实包含了第二个磁盘,为什么系统看不到它?:

Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-55-generic x86_64)
  System information as of Mon Jul 29 19:08:51 CEST 2019

  System load:  0.0                Processes:          170
  Usage of /: 1.1% of 226.78GB     Users logged in:    0
  Memory usage: 0%                 IP address for enp3s0: 192.168.1.5
  Swap usage: 0%

marco@pc:$ sudo vgdisplay
  ---Volume group---
  VG Name                       pc-vg
  System ID
  Format                        lvm2
  Metadata Areas                1
  Metadata Sequence No          3
  VG Access                     read/write
  VG Status                     resizable
  MAX LV                        0
  Cur LV                        2
  Open LV                       2
  Max PV                        0
  Cur PV                        1
  Act PV                        1
  VG Size                       232.38 GiB
  PE Size                       4.00 MiB
  Total PE                     59490
  Alloc PE /Size               59485 / 232.36 GiB
  Free PE/ Size                5 / 20.00 MiB
  VG UUID                      gMe06I-dgYO.g0jr-wyVg-EL2q-Pt0s-ccXke7

如何让系统真正识别 /dev/sdb 中的第二个磁盘?

马可

1°更新:

marco@pc:$ sudo fdisk /dev/sdb
Command : n
Partition type (p / e)
Select: p
Partition number (1-2, default 1):
First sector (default 2048):
Last secont (default 488397167):

Created a new partition 1 of type 'Linux' and of size 232.9 GiB

Command : w
The partition table has been altered
Calling ioctl() to re-read partition table.
Synching disks

marco@pc:$ sudo mkfs.ext4 /dev/sdb
mke2fs 1.44.1 (24-Mar-2018)
Found a dos partition table in /dev/sdb
Proceed anyway (y/N) y
Discarding device blocks: done
Creating filesystem with 61049646 4k blocks and 15269888 ubides
Filesystem UUID: 403e99bd-07f0-4205-aa36-1d3d6fa8572b
Superblock backups stored

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accouring information: done

我重启了

marco@pc:$ sudo mount /dev/sdb /mnt/sdb
mount: /mnt/sdb: /dev/sdb already mounted on /mnt/sdb

marco@pc:$ mount
  /dev/sdb on /mnt/sdb type ext4 (rw, relatime,data=orderedI
  /dev/sda1 on /boot/efi type ext4 
  (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,
   shortname=mixed,errors=remount-ro)

但是 vgdisplay 仍然没有看到 /dev/sdb 中的第二个磁盘

我尝试扩展 VG:

marco@pc:~$ sudo vgextend pc-vg /dev/sdb
Can't open /dev/sdb exclusively.  Mounted filesystem?

相关内容