Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion

Servarica Unlimited Expanding Storage - how do you add the new storage to your existing partitions?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Servarica Unlimited Expanding Storage - how do you add the new storage to your existing partitions?

I'm looking for some automatic way to enlarge the existing partitions with the new space but I not sure how to do it on the LVM partitions.

The other problem is that if there was some unused/unuseable space at the end of the partition, it is not so easy to use resize2fs to do the automatic expansion even if it is not LVM.

So, experts of LET, how do accomplish this if at all?

Or have you given up the automatic option, taking the server offline to run some disk resizing and partitioning utilities to add the space to existing partitions?

Comments

  • jperkinsjperkins Member
    edited April 6

    I have had the unlimited plan for a while now. It works good as a backup. First you have to do a reboot from the control panel of the vps to get the increased size

    image here

    https://ibb.co/8NwMC4H

    So have you modified the existing disk config ? I know if you have moved the storage drives to zfs then this command works without taking anything offline

    zpool online -e tank /dev/xvd?

    the initial setup was accomplished using https://grml.org/ . Its been while but looks like my boot partition still has grml64-small_2021.07.iso . grml still comes up as a boot option in grub. I wont need it unless I want to reinstall the os.

    so I have a smallish xvda which has /boot and a lvm with / .
    xvdb and xvdc are the ones that expand and are on a zpool which is resized using the above command.

    Im sure there are easier ways to do this

    If you are interested in how servarica handled it with the original config that was supplied to me. This script was ran upon reboot. Now this was a couple years ago so YMMV

    xenicastart.sh

    #!/bin/bash
    change_ip(){
    
    if [ ! -f "/opt/xenica_continuerepart" ]; then
            networkFile="/etc/network/interfaces"
    
        #echo "FINE UP TO NOEi $domainid"
        xenica_ip=`xenstore-read vm-data/xenica_ifs/0/ip`
        xenica_gateway=`xenstore-read vm-data/xenica_ifs/0/gateway`
        xenica_subnetmask=`xenstore-read vm-data/xenica_ifs/0/netmask`
        xenica_broadcast=`xenstore-read vm-data/xenica_ifs/0/broadcast`
        xenica_passwd=`xenstore-read vm-data/xenica_passwd`
        #echo "her is ip address $xenica_ip"
    
        echo "ip= $xenica_ip  gateway= $xenica_gateway  subnet= $xenica_subnetmask broadcast= $xenica_broadcast "
    
       pace=" "
        preIp=`cat "$networkFile" | grep 'address ' | awk '{ print $2}'`
        echo "Old  ip is  $preIp "
    
        if [ -z "$xenica_ip" ] ; then
            echo "Could not read Ip Address from the xenstore. It seems IP Address is not written to xenstore.";
            return
        fi
        if [ -z "$xenica_gateway" ] ; then
            echo "Could not read gateway Address from the xenstore. It seems gateway Address is not written to xenstore.";
            return
        fi
        if [ -z "$xenica_subnetmask" ] ; then
            echo "Could not read subnetmask Address from the xenstore. It seems subnetmask Address is not written to xenstore.";
            return
        fi
        if [ -z "$xenica_broadcast" ] ; then
            echo "Could not read subnetmask Address from the xenstore. It seems subnetmask Address is not written to xenstore.";
            return
        fi
        #NOW WE HAVE the data, let us write is using ifconfig.
    
        if [ "$preIp" = "$xenica_ip" ] ; then
            echo "Already Updted IP Address"
            reboot=0
        else
            reboot=1
        fi
    
        #ifconfig eth0 $xenica_ip netmask $xenica_subnetmask  broadcast $xenica_broadcast
    
        if [ $reboot -eq 1 ] ; then
            touch temp.config
             sed "s/gateway [0-9\.]*/gateway $xenica_gateway/"  "$networkFile" >temp.config
             cat temp.config > "$networkFile"
             sed "s/broadcast [0-9\.]*/broadcast $xenica_broadcast/"  "$networkFile" >temp.config
             cat temp.config > "$networkFile"
             sed "s/address [0-9\.]*/address $xenica_ip/"  "$networkFile" >temp.config
             cat temp.config > "$networkFile"
             sed "s/netmask [0-9\.]*/netmask $xenica_subnetmask/"  "$networkFile" >temp.config
             cat temp.config > "$networkFile"
    
            #cat temp.config > "$networkFile"
            rm -f temp.config
            echo "root:$xenica_passwd" | chpasswd
    
            #resizing the disk
    (echo n; echo ; echo ; echo ; echo 8e00; echo w; echo y; echo ;) | gdisk /dev/xvdb
    (echo n; echo ; echo ; echo ; echo 8e00; echo w; echo y; echo ;) | gdisk /dev/xvdc
    (echo n; echo ; echo ; echo ; echo 8e00; echo w; echo y; echo ;) | gdisk /dev/xvde
    (echo n; echo ; echo ; echo ; echo 8e00; echo w; echo y; echo ;) | gdisk /dev/xvdf
    (echo n; echo ; echo ; echo ; echo 8e00; echo w; echo y; echo ;) | gdisk /dev/xvdg
    partprobe /dev/xvdb /dev/xvdc /dev/xvde /dev/xvdf /dev/xvdg
    pvcreate /dev/xvdb1 /dev/xvdc1 /dev/xvde1 /dev/xvdf1 /dev/xvdg1
    vgextend ubuntu-vg /dev/xvdb1 /dev/xvdc1 /dev/xvde1 /dev/xvdf1 /dev/xvdg1
    vgextend ubuntu-vg /dev/xvdb1
    vgextend ubuntu-vg /dev/xvdc1
    vgextend ubuntu-vg /dev/xvde1
    vgextend ubuntu-vg /dev/xvdf1
    vgextend ubuntu-vg /dev/xvdg1
    lvextend -l 100%FREE /dev/ubuntu-vg/lv-root
    resize2fs /dev/ubuntu-vg/lv-root
    
    touch "/opt/xenica_continuerepart"
    reboot
    fi
    fi
    
    touch "/opt/firstbootdone.log"
    rm -f "/opt/xenica_continuerepart"
            echo "Rebooting to change ip address..."
            reboot
    }
    
    resize_part(){
     #resizing the disk
    (echo n; echo ; echo ; echo ; echo 8e00; echo w; echo y; echo ;) | gdisk /dev/xvdb
    (echo n; echo ; echo ; echo ; echo 8e00; echo w; echo y; echo ;) | gdisk /dev/xvdc
    (echo n; echo ; echo ; echo ; echo 8e00; echo w; echo y; echo ;) | gdisk /dev/xvde
    (echo n; echo ; echo ; echo ; echo 8e00; echo w; echo y; echo ;) | gdisk /dev/xvdf
    (echo n; echo ; echo ; echo ; echo 8e00; echo w; echo y; echo ;) | gdisk /dev/xvdg
    partprobe /dev/xvdb /dev/xvdc /dev/xvde /dev/xvdf /dev/xvdg
    pvcreate /dev/xvdb1 /dev/xvdc1 /dev/xvde1 /dev/xvdf1 /dev/xvdg1
    vgextend ubuntu-vg /dev/xvdb1 /dev/xvdc1 /dev/xvde1 /dev/xvdf1 /dev/xvdg1
    vgextend ubuntu-vg /dev/xvdb1
    vgextend ubuntu-vg /dev/xvdc1
    vgextend ubuntu-vg /dev/xvde1
    vgextend ubuntu-vg /dev/xvdf1
    vgextend ubuntu-vg /dev/xvdg1
    lvextend -l 100%FREE /dev/ubuntu-vg/lv-root
    resize2fs /dev/ubuntu-vg/lv-root
    
    reboot
    }
    extra_ip(){
    
            networkFile="/etc/network/interfaces"
    
             i=$1
    
        xenica_ip=`xenstore-read vm-data/xenica_ifs/$i/ip`
        xenica_gateway=`xenstore-read vm-data/xenica_ifs/$i/gateway`
        xenica_subnetmask=`xenstore-read vm-data/xenica_ifs/$i/netmask`
        xenica_broadcast=`xenstore-read vm-data/xenica_ifs/$i/broadcast`
    
            echo "ip= $xenica_ip  gateway= $xenica_gateway  subnet= $xenica_subnetmask broadcast= $xenica_broadcast "
    
       pace=" "
        preIp=`cat "$networkFile" | grep 'address ' | awk '{ print $2}'`
        echo "Old  ip is  $preIp "
    
        if [ -z "$xenica_ip" ] ; then
            echo "Could not read Ip Address from the xenstore. It seems IP Address is not written to xenstore.";
            return
        fi
        if [ -z "$xenica_gateway" ] ; then
            echo "Could not read gateway Address from the xenstore. It seems gateway Address is not written to xenstore.";
            return
        fi
        if [ -z "$xenica_subnetmask" ] ; then
            echo "Could not read subnetmask Address from the xenstore. It seems subnetmask Address is not written to xenstore.";
            return
        fi
        if [ -z "$xenica_broadcast" ] ; then
            echo "Could not read subnetmask Address from the xenstore. It seems subnetmask Address is not written to xenstore.";
            return
        fi
        #NOW WE HAVE the data, let us write is using ifconfig.
    
        if [ "$preIp" = "$xenica_ip" ] ; then
            echo "Already Updted IP Address"
            reboot=0
        else
            reboot=1
        fi
    
        #ifconfig eth0 $xenica_ip netmask $xenica_subnetmask  broadcast $xenica_broadcast
    
        if [ $reboot -eq 1 ] ; then
    
    
                     echo "auto eth0:$i" >> $networkFile
                     echo "iface eth0:$i inet static" >> $networkFile
                     echo  "address $xenica_ip" >> $networkFile
                     echo "netmask $xenica_subnetmask" >> $networkFile
    fi
    
    }
    change_passwd(){
    
        xenica_passwd=`xenstore-read vm-data/xenica_passwd`
    
            echo "root:$xenica_passwd" | chpasswd
            echo "Rebooting to change ip address..."
            reboot
    
    }
    #xenica_command=`xenstore-read vm-data/xenica_command`
    
    FLAG="/opt/firstbootdone.log"
    if [ ! -f $FLAG ]; then
    change_ip
    #elif [$xenica_command -eq "changeip"]; then
    #change_passwd
    #elif [$xenica_command -eq "resize"]; then
    #resize_part
    #elif [$xenica_command -eq "extraip"]; then
    #extra_ip
    fi
    #####################################################################################################
    FLAG="/opt/extraip.log"
    COUNTER=1
    if [ ! -f $FLAG ]; then
    while [  $COUNTER -lt 50 ]; do
       xenica_ip=`xenstore-read vm-data/xenica_ifs/$COUNTER/ip` && extra_ip $COUNTER
    #echo $COUNTER
    COUNTER=$((COUNTER+1))
    done
    echo $(xenstore-read vm-data/xenica_ifs/1/ip6) | grep -q ':' && ipv6=1;
    touch /opt/extraip.log
    
    #IPV6 Assignment
    if [ $ipv6 -eq "1" ]
    then
    printf "###start IPv6 Config
    iface eth0 inet6 static
    pre-up modprobe ipv6
    address $(xenstore-read vm-data/xenica_ifs/1/ip6)
    netmask $(xenstore-read vm-data/xenica_ifs/1/netmask6)" >> /etc/network/interfaces
    touch /opt/ip6.log
    fi
    
    reboot
    fi
    #######################################################################
    xenica_list=`xenstore-list vm-data`
    for item in ${xenica_list[*]}
    do
    if [[ $item =  *"xenica_script"*  ]]; then
     #   printf "   %s\n" $item
    
    xenica_script=`xenstore-read vm-data/$item`
    cd /root/
    touch xenica.sh
    echo "$xenica_script" > xenica.sh;
    chmod +x xenica.sh
    
    `xenstore-write vm-data/$item ""`
    `xenstore-rm vm-data/$item`
    
    ./xenica.sh
    
    #delete the script file
    rm -f xenica.sh
    
    #empty xenstore xenica_script record
    
    fi
    done
    
    #######################################################################
    
Sign In or Register to comment.