• www.dafa888.com.cn|www.dafa888.com.cn【单日提款限额高达600W】

  • 发布时间:2016-01-15 13:59 | 作者:yc | 来源:互联网 | 浏览:1200 次
  • www.dafa888.com.cn|www.dafa888.com.cn【单日提款限额高达600W】

    ls /dev/sda >/dev/null 2>&1;

    if [ $? = 0 ]; then

    /sbin/pvcreate /dev/sda

    /sbin/vgcreate domuvg /dev/sda

    /sbin/lvcreate -L 1G -n swap domuvg

    www.dafa888.com.cn|www.dafa888.com.cn【单日提款限额高达600W】

    /sbin/mkswap /dev/domuvg/swap

    /sbin/swapon /dev/domuvg/swap

    echo "/dev/domuvg/swapswapswapdefaults0 0" >> /etc/fstab

    mkdir -p /alidata

    /sbin/lvcreate -l +100%FREE -n alidata domuvg

    /sbin/mkfs.ext4 /dev/domuvg/alidata

    if [ `ls -r /alidata |wc -l` = 0 ]; then

    /bin/mount /dev/domuvg/alidata /alidata

    echo "/dev/domuvg/alidata/alidataext4defaults0 0" >> /etc/fstab

    fi

    fi

    运用此脚本对/dev/sda做LVM,而且分红2个分区

    场景:sda做了lvm,如今容量不可,需求扩容,新增添了sdb,把sdb的容量扩容到sda里边,增添sda的容量

    1、反省如今物理卷状况

    [root@localhost ~]# pvdisplay

    --- Physical volume ---

    PV Name/dev/sda

    VG Namedomuvg

    PV Size8.00 GiB / not usable 4.00 MiB

    Allocatableyes (but full)

    PE Size4.00 MiB

    Total PE2047

    Free PE0

    Allocated PE2047

    PV UUIDv8b8aP-6Lq6-I3gR-f1p6-89nu-Bk67-tPA5hh

    2、对付sdb树立物理卷

    [root@localhost ~]# pvcreate /dev/sdb

    Physical volume "/dev/sdb" successfully created

    3、反省如今物理卷状况

    [root@localhost ~]# pvdisplay

    --- Physical volume ---

    PV Name/dev/sda

    VG Namedomuvg

    PV Size8.00 GiB / not usable 4.00 MiB

    Allocatableyes (but full)

    PE Size4.00 MiB

    Total PE2047

    Free PE0

    Allocated PE2047

    PV UUIDv8b8aP-6Lq6-I3gR-f1p6-89nu-Bk67-tPA5hh

    "/dev/sdb" is a new physicwww.118kj.comal volume of "5.00 GiB"

    --- NEW Physical volume ---

    PV Name/dev/sdb

    VG Name

    PV Size5.00 GiB

    AllocatableNO

    PE Size0

    Total PE0

    Free PE0

    Allocated PE0

    PV UUIDyOWwty-2dfz-5DN4-aSgH-VijX-1LAT-fb8irp

    4、增添sdb到如今的卷组中

    [root@localhost ~]# vgextend domuvg /dev/sdb

    Volume group "domuvg" successfully extended

    5、反省如今物理卷状况

    [root@localhost ~]# pvdisplay

    www.dafa888.com.cn|www.dafa888.com.cn【单日提款限额高达600W】--- Physical volume ---

    PV Name/dev/sda

    VG Namedomuvg

    PV Size8.00 GiB / not usable 4.00 MiB

    Allocatableyes (but full)

    PE Size4.00 MiB

    Total PE2047

    Free PE0

    Allocated PE2047

    PV UUIDv8b8aP-6Lq6-I3gR-f1p6-89nu-Bk67-tPA5hh

    --- Physical volume ---

    PV Name/dev/sdb

    VG Namedomuvg

    PV Size5.00 GiB / not usable 4.00 MiB

    Allocatableyes

    PE Size4.00 MiB

    Total PE1279

    Free PE1279

    Allocated PE0

    PV UUIDyOWwty-2dfz-5DN4-aSgH-VijX-1LAT-fb8irp

    6、反省卷组的状况

    [root@localhost ~]# vgdisplay

    --- Volume group ---

    VG Namedomuvg

    System ID

    Formatlvm2

    Metadata Areas2

    Metadata Sequence No4

    VG Accessread/write

    VG Statusresizable

    MAX LV0

    Cur LV2

    Open LV2

    Max PV0

    Cur PV2

    Act PV2

    VG Size12.99 GiB

    PE Size4.00 MiB

    Total PE3326

    Alloc PE / Size2047 / 8.00 GiB

    FreePE / Size1279 / 5.00 GiB

    VG UUIDVJ4tsH-IFB3-Ft1O-Rnxc-nFfw-hDNE-ggB0Az

    7、拓展lv的容量

    [root@localhost ~]# lvextend -l +100%FREE /dev/domuvg/alidata#悉数扩容到/dev/domuvg/alidata此逻辑卷上

    Size of logical volume domuvg/alidata 617888netchanged from 7.00 GiB (1791 extents) to 11.99 GiB (3070 extents).

    Logical volume alidata successfully resized

    8、反省容量

    [root@localhost ~]# df -Ph

    FilesystemSizeUsed Avail Use% Mounted on

    /dev/sdc27.3G1.1G5.9G15% /

    tmpfs939M0939M0% /dev/shm

    /dev/mapper/domuvg-alidata6.8G16M6.4G1% /alidata#巨细没有扩容

    9、运用resize2fs扩容

    [root@localhost ~]# resize2fs /dev/domuvg/alidata

    resize2fs 1.41.12 (17-May-2010)

    Filesystem at /dev/domuvg/alidata is mounted on /alidata; on-line resizing required

    old desc_blocks = 1, new_desc_blocks = 1

    Performing an on-line resize of /dev/domuvg/alidata to (4k) blocks.

    The filesystem on /dev/domuvg/alidata is now blocks long.

    [root@localhost ~]# df -Ph

    FilesystemSizeUsed Avail Use% Mounted on

    /dev/sdc27.3G1.1G5.9G15% /

    tmpfs939M0939M0% /dev/shm

    /dev/mapper/domuvg-alidata12G18M12G1% /alidata

    由开始的8G扩容到了12G,增添了5G

    这篇文章出自 “freeterman” 博客,请必须保存此出处http://myunix.blog.51cto.com//

  • 相关内容

友情链接: