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

What is the method of expanding hard disk in linux system VPS

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "what is the method of expanding hard disk in linux system VPS". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

[root@cloud ~] # df-hal to view the disk status after capacity expansion.

File system capacity used available mount point% used

/ dev/mapper/vg_cloud-lv_root

7.5g 7.5g 0 100% /

Proc 0 000-/ proc

Sysfs 0 000-/ sys

Devpts 0 000-/ dev/pts

Tmpfs 494m 0 494m 0% / dev/shm

/ dev/sda1 485M 33M 427M 8% / boot

None 0 000-/ proc/sys/fs/binfmt_misc

Sunrpc 0 000-/ var/lib/nfs/rpc_pipefs

[root@cloud wwwroot] # fdisk-l to view partitions. You can see here that / dev/sdc is the disk that you just added without partition.

Disk / dev/sda: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00051f5f

Device Boot Start End Blocks Id System

/ dev/sda1 * 1 64 512000 83 Linux

Partition 1 does not end on cylinder boundary.

/ dev/sda2 64 1306 9972736 8e Linux LVM

Disk / dev/sdb: 53.7 GB, 53687091200 bytes

255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Disk / dev/mapper/vg_cloud-lv_root: 8128 MB, 8128561152 bytes

255 heads, 63 sectors/track, 988 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Disk / dev/mapper/vg_cloud-lv_swap: 2080 MB, 2080374784 bytes

255 heads, 63 sectors/track, 252 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

[root@cloud ~] # fdisk / dev/sdb for partition. Fdisk partitioning the hard disk is essentially a kind of formatting of the hard disk.

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklable

Building a new DOS disklabel with disk identifier 0x3c59d1a9.

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: 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 partition

Command action

E extended

P primary partition (1-4)

P # set the primary partition

Partition number (1-4): 1 # main partition number

First cylinder (1-2610, default 1): 1 # start sector (direct default enter)

Using default value 1

Last cylinder, + cylinders or + size {KMagne Mpeng} (1-2610, default 2610): 2610

Using default value 2610 # end sector (direct default enter)

Command (m for help): t # specifies the partition type

Selected partition 1 # Select Partition 1

Hex code (type L to list codes): 8e # 8e is LVM

Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): W # Save

The partition table has been altered!

Calling ioctl () to re-read partition table.

Syncing disks.

[root@cloud ~] # reboot

=

Rebooting

=

[root@cloud ~] # vgs

VG # PV # LV # SN Attr VSize VFree

Vg_cloud 1 2 0 wz--n- 9.51g 0

[root@cloud ~] # pvcreate / dev/sdb1

Physical volume "/ dev/sdb1" successfully created

[root@cloud ~] # vgextend vg_cloud / dev/sdb1

Volume group "vg_cloud" successfully extended

[root@cloud ~] # vgdisplay

-Volume group

VG Name vg_cloud

System ID

Format lvm2

Metadata Areas 2

Metadata Sequence No 4

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 59.50 GiB

PE Size 4.00 MiB

Total PE 15233

Alloc PE / Size 2434 / 9.51 GiB

Free PE / Size 12799 / 50.00 GiB

VG UUID I5k6GO-mjni-7dO0-O4TF-RUxH-RNcI-bnWFY3

[root@cloud] # lvresize-L + 49.900G / dev/vg_cloud/lv_root

Rounding size to boundary between physical extents: 49.90 GiB

Extending logical volume lv_root to 57.47 GiB

Logical volume lv_root successfully resized

[root@cloud ~] # resize2fs / dev/vg_cloud/lv_root

Resize2fs 1.41.12 (17-May-2010)

Filesystem at / dev/vg_cloud/lv_root is mounted on /; on-line resizing required

Old desc_blocks = 1, new_desc_blocks = 4

Performing an on-line resize of / dev/vg_cloud/lv_root to 15066112 (4k) blocks.

The filesystem on / dev/vg_cloud/lv_root is now 15066112 blocks long.

[root@cloud ~] # df-hal

File system capacity used available mount point% used

/ dev/mapper/vg_cloud-lv_root

57G 7.5g 47G 14% /

Proc 0 000-/ proc

Sysfs 0 000-/ sys

Devpts 0 000-/ dev/pts

Tmpfs 494m 0 494m 0% / dev/shm

/ dev/sda1 485M 33M 427M 8% / boot

None 0 000-/ proc/sys/fs/binfmt_misc

Sunrpc 0 000-/ var/lib/nfs/rpc_pipefs

=

Expand successfully

=

This is the end of the content of "what is the method of expanding the hard disk in linux system VPS". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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