Wie füge ich neue Laufwerke zum Fedora-Root hinzu?

Wie füge ich neue Laufwerke zum Fedora-Root hinzu?

Ich versuche, Speicherplatz hinzuzufügen /dev/mapper/fedora-root. Ich kann ihn ausführen lvextendund erfolgreich zusätzlichen Speicherplatz hinzufügen, aber er scheint nicht wirklich nutzbar zu sein.

Konkret stehen mir auf meiner Site dort 15 GB zur Verfügung, /var/www/wo ich den gesamten Speicherplatz benötige.

Ich habe zusätzlichen Speicherplatz auf dem Laufwerk, auf dem Fedora-Root installiert ist, und weitere 2 TB Speicherplatz auf einem zweiten Laufwerk. Aber jedes Mal, wenn ich Speicherplatz hinzufüge, bleibt er bei 15 GB.

Hier sind die Ausgaben einiger Befehle, die nützlich sein können:

$ sudo df -h

Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                  24G     0   24G   0% /dev
tmpfs                     24G  8.0K   24G   1% /dev/shm
tmpfs                     24G  1.5M   24G   1% /run
/dev/mapper/fedora-root   15G   14G  1.5G  91% /
tmpfs                     24G  4.0K   24G   1% /tmp
/dev/sda1               1014M  224M  791M  22% /boot
tmpfs                    4.8G     0  4.8G   0% /run/user/1000
tmpfs                    4.8G     0  4.8G   0% /run/user/0

$ sudo vgdisplay -v

  --- Volume group ---
  VG Name               fedora
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  12
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               2.08 TiB
  PE Size               4.00 MiB
  Total PE              546110
  Alloc PE / Size       11235 / <43.89 GiB
  Free  PE / Size       534875 / 2.04 TiB
  VG UUID               lgfK0B-loTg-wQlS-dtsR-qWZJ-Hqh6-SkWk55

  --- Logical volume ---
  LV Path                /dev/fedora/swap
  LV Name                swap
  VG Name                fedora
  LV UUID                81zkKH-IeMO-gcoO-O9DX-7w7G-4a1i-lw2dhy
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-11-24 17:33:39 -0500
  LV Status              available
  # open                 2
  LV Size                <23.64 GiB
  Current LE             6051
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/fedora/root
  LV Name                root
  VG Name                fedora
  LV UUID                e9fRu0-FupO-8e6V-fodF-ZPQ5-alBK-XVutVM
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-11-24 17:33:40 -0500
  LV Status              available
  # open                 1
  LV Size                20.25 GiB
  Current LE             5184
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Physical volumes ---
  PV Name               /dev/sda2
  PV UUID               AdC6bu-ct2C-dP0k-TRM8-PZ7z-vYDj-tN5jGn
  PV Status             allocatable
  Total PE / Free PE    69439 / 58204

  PV Name               /dev/sdb1
  PV UUID               n6tBpo-ce7D-MCZR-GFKY-BsHW-pcmG-FmM3Wo
  PV Status             allocatable
  Total PE / Free PE    476671 / 476671

$ sudo lvextend -l+288 /dev/mapper/fedora-root

  Size of logical volume fedora/root changed from 20.25 GiB (5184 extents) to <21.38 GiB (5472 extents).
  Logical volume fedora/root successfully resized.

$ sudo fdisk -l

Disk /dev/sda: 272.26 GiB, 292326211584 bytes, 570949632 sectors
Disk model: PERC 6/i
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdf465195

Device     Boot   Start       End   Sectors   Size Id Type
/dev/sda1  *       2048   2099199   2097152     1G 83 Linux
/dev/sda2       2099200 570949631 568850432 271.3G 8e Linux LVM


Disk /dev/sdb: 1.84 TiB, 1999307276288 bytes, 3904897024 sectors
Disk model: PERC 6/i
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8e545053

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1        2048 3904897023 3904894976  1.8T 8e Linux LVM


Disk /dev/mapper/fedora-root: 21.38 GiB, 22951231488 bytes, 44826624 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 /dev/mapper/fedora-swap: 23.65 GiB, 25379733504 bytes, 49569792 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

Wenn Sie „sudo df -h“ erneut ausführen, erhalten Sie:

    $ sudo df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                  24G     0   24G   0% /dev
tmpfs                     24G  8.0K   24G   1% /dev/shm
tmpfs                     24G  1.5M   24G   1% /run
/dev/mapper/fedora-root   15G   14G  1.5G  91% /
tmpfs                     24G  4.0K   24G   1% /tmp
/dev/sda1               1014M  224M  791M  22% /boot
tmpfs                    4.8G     0  4.8G   0% /run/user/1000
tmpfs                    4.8G     0  4.8G   0% /run/user/0

BEARBEITEN: $ sudo lsblk -f

NAME            FSTYPE      LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINT
sda
├─sda1          xfs               59ff08c1-39e5-4cdd-87a8-d51d7aead2e5      791M    22% /boot
└─sda2          LVM2_member       AdC6bu-ct2C-dP0k-TRM8-PZ7z-vYDj-tN5jGn
  ├─fedora-root xfs               cd4163ba-8b53-48db-bd30-32802f4bd3a0      1.4G    91% /
  └─fedora-swap swap              2de89191-34eb-4439-81a8-2f879d917821                  [SWAP]
sdb
└─sdb1          LVM2_member       n6tBpo-ce7D-MCZR-GFKY-BsHW-pcmG-FmM3Wo

Antwort1

Um den Speicherplatz verfügbar zu machen, müssen Sie den Befehl verwenden, xfs_growfsda das Dateisystem auf Ihrem logischen Datenträger ist xfs.

xfs_growfs /

Wenn es ext2, ext3 oder ext4 wäre, würden Sie resize2fsmit dem Namen verwenden.

BEARBEITEN: Es scheint in der neuesten Version für Fedora, RHEL 8 und CentOS 8 geändert worden zu sein. Die Verwendung des lv/block-Geräts funktioniert in RHEL 7 und CentOS 7, aber Sie müssen den Einhängepunkt für Ihr Betriebssystem verwenden, da es eine neuere Version des Dienstprogramms verwendet.

verwandte Informationen