In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to expand the disk space of linux server, which is very detailed and has certain reference value. Friends who are interested must finish reading it.
Steps
The disk already has two partitions, but the space allocated is small.
Add the disk and mount the new disk sdc through the management
Create a new partition using fdisk / dev/sdc
[root@localhost indices] # fdisk / dev/sdcDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel with disk identifier 0x5799aeba.Changes will remain in memory only, until you decide to write them.After that, of course, the previous content won't be recoverable.Warning: invalid flag 0x0000 of partition table 4 will be corrected by w (rite) WARNING: The size of this disk is 2.2 TB (2199023255552 bytes). DOS partition table format can not be used on drives for volumeslarger than (2199023255040 bytes) for 512-byte sectors. Use parted (1) and GUID partition table format (GPT). WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u') .Command (m for help): n # new new partition Command action e extended p primary partition (1-4) p # Select main sector Partition number (1-4): 1 # start sector First cylinder (1-267349, default 1): # here directly enter means to take the default value 1Using default value 1Last cylinder, + cylinders or + size {KJM G} (1-267349, default 267349): # here, because es needs a lot of storage space So I added 2 T of space, normally you can change the sector size Using default value 267349Command (m for help): W # save and exit The partition table has been altered calling ioctl () to re-read partition table.Syncing disks.
Then create a physical volume and use the pvcreate / dev/sdc1 command. Note: many articles here require a restart of the system, but it can be operated directly without restarting without affecting the normal operation of the server.
[root@localhost indices] # pvcreate / dev/sdc1 Physical volume "/ dev/sdc1" successfully created
Use vgscan to view physical volume group names
[root@localhost indices] # vgscan Reading all physical volumes. This may take a while... Found volume group "VolGroup" using metadata type lvm2 # where the physical volume group name is VolGroup
Load the physical sector you just added into the volume group, using vgextend VolGroup / dev/sdc1 here
[root@localhost indices] # vgextend VolGroup / dev/sdc1 Volume group "VolGroup" successfully extended
Increase the size of the volume group, using lvextend-L + 2048G / dev/mapper/VolGroup-lv_root here
[root@localhost indices] # lvextend-L + 2048G / dev/mapper/VolGroup-lv_root Size of logical volume VolGroup/lv_root changed from 135.47 GiB (34681 extents) to 2.13 TiB (558848 extents). Logical volume lv_root successfully resized.
Use df-h to check the space expansion and find that the space is not expanded because the file system is not synchronized yet
[root@localhost indices] # df-hFilesystem Size Used Avail Use% Mounted on/dev/mapper/VolGroup-lv_root 134G 119G 8.4G 94% / tmpfs 32G 72K 32G 1% / dev/shm/dev/sda1 477M 41M 411M 10% / boot
Synchronize the file system, using xfs_growfs or resize2fs to synchronize the file system, as follows
[root@localhost indices] # resize2fs-f / dev/mapper/VolGroup-lv_rootresize2fs 1.41.12 (17-May-2010) Filesystem at / dev/mapper/VolGroup-lv_root is mounted on /; on-line resizing requiredold desc_blocks = 9, new_desc_blocks = 137Performing an on-line resize of / dev/mapper/VolGroup-lv_root to 572260352 (4k) blocks.The filesystem on / dev/mapper/VolGroup-lv_root is now 572260352 blocks long.
Then use df-h to check the space expansion.
[root@localhost indices] # df-hFilesystem Size Used Avail Use% Mounted on/dev/mapper/VolGroup-lv_root 2.1T 125G 1.9T 7% / tmpfs 32G 72K 32G 1% / dev/shm/dev/sda1 477M 41m 411M 10% / boot
Because of the difference between CentOS6 and CentOS7 in the file system format of the default root file system, you need to determine whether it is xfs, and if it is xfs, you should use xfs_growfs instead of resize2fs.
The above is all the contents of the article "how to expand the disk space of linux server". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.