Linux adds a new hard disk to an existing logical volume

Source: Internet
Author: User

Linux adds a new hard disk to an existing logical volume

In order to make full use of the resources, you want to use the extra hard disk to expand the existing machines, can be used to store the backup files.
Environment:
Operating system, Centos 6.5 x86_64

1. Install the hard disk, the hard disk size is 160G;
Hard disk Information: Previous Linux system, not formatted.

2. Boot, format the hard drive

Found new hard drive is SDB1, volume Group is VolGroup00, logical volume is LogVol00 and LOGVOL01
Remove the logical volume with 2

#lvremove/dev/volgroup00/logvol00#lvremove/dev/volgroup00/logvol01

Remove a volume group

Vgremove VolGroup00


Repartition partitions

#fdisk/dev/sdbcommand (M for help): Dselected partition 1Command (M-help): Ncommand action E extended P Prim ary partition (1-4) ppartition number (1-4): 1First cylinder (1-19457, default 1): Using default value 1Last cylinder, +cyl Inders or +size{k,m,g} (1-19457, default 19457): Using default value 19457Command (M for help): tselected partition 1Hex C Ode (type L to list codes): 8eChanged system type of partition 1 to 8e (Linux LVM) Command (M-help): w# mkfs.ext4/dev/ Sdb1

3. Create a physical volume

# PVCREATE/DEV/SDB1

4. Extended Volume Group

# Vgextend VOLGROUP/DEV/SDB1

5. Extending the logical Volume

Umount/home/lvextend-l +149g/dev/volgroup/lv_homemount/dev/mapper/volgroup-lv_home/home/

6. After the expansion, change the file system size

Resize2fs/dev/volgroup/lv_home

7. New HDD post-information

# pvs  pv         vg        Fmt  Attr PSize   PFree   /dev/sda2   volgroup lvm2 a--  465.27g     0   /dev/sdb1   VolGroup lvm2 a--  149.05g 48.00m# vgs  VG         #PV   #LV   #SN  Attr   VSize   VFree    VolGroup   2   3   0 wz--n- 614.32g  48.00m# lvs  lv      vg        attr       lsize   pool origin data%   Meta%  move log cpy%sync convert  lv_home volgroup -wi-ao----  560.39g                                                        lv_root  Volgroup -wi-ao----  50.00g                                                         lv_swap volgroup -wi-ao----   3.88g




Linux adds a new hard disk to an existing logical volume

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.