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

Virtual linux disk expansion under VM VirtualBoX

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

My VirtualBox virtual machine linux system has a total of 8 gigabytes of disks. I need to expand the capacity.

Reference blog: https://www.cnblogs.com/anjingshen/archive/2015/10/17/4887426.html

Reference blog: http://blog.jues.org.cn/post/resize2fs-bad-magic-number-in-super-block-dang-chang-shi-da-kai-devcentosvir-centos7root-shi-zhao-bu-dao-you-xiao-de-wen-jian-xi-tong-chao-ji-kuai-..html

The steps for capacity expansion are as follows:

1. Add a new virtual disk and create it as prompted.

2. There is an extra sdb in lsblk query.

3. Partition and format the new hard disk

Type "fdisk / dev/sdb" to start partitioning the new hard drive

Type "n" on the new command line to create a new partition

Enter directly as the main partition

Type the partition number, or enter directly by default 1

Enter defaults to 2048 as the start sector of this partition.

Enter defaults to the last sector as the end sector

Type "w" to save and exit, now get the / dev/sdb1 partition, it is recommended to restart the following virtual machines

4. Add a new partition to lvm and expand its capacity

Type "pvcreate / dev/sdb1"

Physical volume "/ dev/hda4" successfully created

Type "vgs" to view the volume group name, such as "centos" or "VolGroup00"

Type "vgextend centos / dev/sdb1" to add a new partition to the volume group

Type "lvs" to view the name of the logical volume to be expanded, such as "root"

Type "lvextend-L + 2048m / dev/centos/root" to expand the logical partition, where "+ 2048M" indicates an increase of 2G space (usually this is smaller than 2048).

Type "resize2fs-p / dev/centos/root" to activate the new space

Note: if it is a xfs file system, you cannot use resize2fs, but use xfs_growfs / dev/centos/root to activate it.

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