Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use LVM to add storage to a Fedora system

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to use LVM to add storage for the Fedora system", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use LVM to add storage for the Fedora system" this article.

Prepare for

Make sure you can see the disk you want to add. Use lsblk to see which storage space is available or in use before adding disks.

$lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTzram0 251└─ 0 0989M 0 disk [SWAP] vda 252 Vol 0 020G 0 disk vda1 252 V 1 0 1G 0 part / boot └─ vda2 252 V 2 0 19G 0 part fedora_fedora-root 253V 019G 0 lvm /

This article uses a virtual machine with virtual storage, so the device name starts with vda for the first disk, vdb for the second disk, and so on. Your device name may be different. Many systems use sda as the first physical disk, sdb represents the second disk, and so on.

When the new disk is connected and your system is backed up and running, use lsblk again to view the new block device.

$lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTzram0 251 └─ 0 0989M 0 disk [SWAP] vda 252 Vol 0 020G 0 disk vda1 252 V 1 0 1G 0 part / boot └─ vda2 252 V 2 0 19G 0 part fedora_fedora-root 253 0 19G 0 lvm / vdb 252:16 0 10G 0 disk

Now there is a new device called vdb. The location of the device is / dev/vdb.

$ls-l / dev/vdbbrw-rw----. 1 root disk 252, 16 Nov 24 12:56 / dev/vdb

We can see the disk, but we can't use it with LVM yet. If you run blkid, you should not see it listed. For this and subsequent commands, you need to make sure that your system is configured so that you can use sudo:

$sudo blkid/dev/vda1: UUID= "4847cb4d-6666-47e3-9e3b-12d83b2d2448" BLOCK_SIZE= "4096" TYPE= "ext4" PARTUUID= "830679b8-01" / dev/vda2: UUID= "k5eWpP-6MXw-foh6-Vbgg-JMZ1-VEf9-ARaGNd" TYPE= "LVM2_member" PARTUUID= "830679b8-02" / dev/mapper/fedora_fedora-root: UUID= "f8ab802f-8c5f-4766-af33-90e78573f3cc" BLOCK_SIZE= "4096" TYPE= "ext4" / dev/zram0: UUID= "fc6d7a48-2bd5-4066-9bcf-f062b61f6a60" TYPE= "swap" add disks to LVM

Initialize the disk using pvcreate. You need to pass the full path of the device. In this case, it is / dev/vdb. In your system, it may be / dev/sdb or other device name.

$sudo pvcreate / dev/vdbPhysical volume "/ dev/vdb" successfully created.

When you run blkid, you should see that the disk has been initialized to a LVM2_member:

Sudo blkid/dev/vda1: UUID= "4847cb4d-6666-47e3-9e3b-12d83b2d2448" BLOCK_SIZE= "4096" TYPE= "ext4" PARTUUID= "830679b8-01" / dev/vda2: UUID= "k5eWpP-6MXw-foh6-Vbgg-JMZ1-VEf9-ARaGNd" TYPE= "LVM2_member" PARTUUID= "830679b8-02" / dev/mapper/fedora_fedora-root: UUID= "f8ab802f-8c5f-4766-af33-90e78573f3cc" BLOCK_SIZE= "4096" TYPE= "ext4" / dev/zram0: UUID= "fc6d7a48-2bd5-4066-9bcf-f062b61f6a60" TYPE= "swap" / dev/vdb: UUID= "4uUUuI-lMQY-WyS5-lo0W-lqjW-Qvqw-RqeroE" TYPE= "LVM2_member"

You can use pvs to list all currently available physical volumes:

$sudo pvsPV VG Fmt Attr PSize PFree/dev/vda2 fedora_fedora lvm2 a muri-

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report