Announcement

Collapse
No announcement yet.

Expand Storage Instructions updated - How to add another drive to /storage

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Expand Storage Instructions updated - How to add another drive to /storage

    The Expand Storage howto is a bit out of date.
    This update VB 2.4 Storage Expansion.zip is a follow on from https://www.vortexbox.org/forum/supp...sd-data-on-hdd .

  • #2
    It appears that attachments don't work, neither do large posts, so I will post the procedure in chunks.
    Part one.

    StorageExpansion
    How to expand the /storage filesystem with another disk

    These steps assume that you installed Vortexbox using the "twodiskinstall".


    This assumes that you have setup Putty
    https://wiki.vortexbox.org/troublesh...a_command_line
    In reading this how-to, [[email protected] ~]# is the command line prompt from my system.
    I have used a lot of display commands to show status both before and after a change command is given. Also, the disks were previously used in Windows and Linux systems and occasionally threw warnings when changes were being made.


    The following steps show a system where /storage is on a 4T + 2T drive and an additional 2T drive is added so that /storage is expanded to ~8T in size.

    step 1 - Make sure you have a good backup

    step 2- Shut down the system and physically install your new disk

    step 3 - boot vortexbox, login via Putty (ssh) and create a partition table on the new drive

    Code:
    [[email protected] ~]# fdisk -l
    Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: DA1C7E00-7FA7-44DD-8069-B0C56E59AE0F
    
    Device       Start      End  Sectors  Size Type
    /dev/sda1     2048     4095     2048    1M BIOS boot
    /dev/sda2     4096   618495   614400  300M Linux filesystem
    /dev/sda3   618496  1667071  1048576  512M Linux swap
    /dev/sda4  1667072 64581631 62914560   30G Linux filesystem
    
    
    Disk /dev/sdb: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disklabel type: gpt
    Disk identifier: F974EF6C-3803-4E3A-8AE2-64CD6BC2AD04
    
    Device     Start        End    Sectors  Size Type
    /dev/sdb1   2048 7814037134 7814035087  3.7T Linux filesystem
    
    
    Disk /dev/sdc: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: 6B412C08-C76D-4AA3-9687-BF96B7212F0E
    
    Device     Start        End    Sectors  Size Type
    /dev/sdc1   2048 3907029134 3907027087  1.8T Linux filesystem
    
    
    Disk /dev/sdd: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    
    Disk /dev/mapper/StorageVM-lv_storage: 5.5 TiB, 6001143054336 bytes, 11720982528 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    [[email protected] ~]#
    Disk /dev/sdd is the new drive to be added.

    Code:
    [[email protected] ~]# fdisk /dev/sdd
    
    Welcome to fdisk (util-linux 2.28.2).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    Device does not contain a recognized partition table.
    Created a new DOS disklabel with disk identifier 0xc4e9464d.
    
    Command (m for help): p
    Disk /dev/sdd: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0xc4e9464d
    
    Command (m for help): g
    Created a new GPT disklabel (GUID: 52FAA7F9-BC09-496F-B5BE-44A2A3AA77E9).
    
    Command (m for help): p
    Disk /dev/sdd: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: 52FAA7F9-BC09-496F-B5BE-44A2A3AA77E9
    
    Command (m for help): n
    Partition number (1-128, default 1):
    First sector (2048-3907029134, default 2048):
    Last sector, +sectors or +size{K,M,G,T,P} (2048-3907029134, default 3907029134):
    
    Created a new partition 1 of type 'Linux filesystem' and of size 1.8 TiB.
    
    Command (m for help): p
    Disk /dev/sdd: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: 52FAA7F9-BC09-496F-B5BE-44A2A3AA77E9
    
    Device     Start        End    Sectors  Size Type
    /dev/sdd1   2048 3907029134 3907027087  1.8T Linux filesystem
    
    Command (m for help): w
    The partition table has been altered.
    Calling ioctl() to re-read partition table.
    Syncing disks.
    
    [[email protected] ~]#

    Comment


    • #3
      Part 2.

      step 4- use pvcreate to create a physical volume on the new disk

      Code:
      [[email protected] ~]# pvcreate /dev/sdd1
      WARNING: ntfs signature detected on /dev/sdd1 at offset 3. Wipe it? [y/n]: y
        Wiping ntfs signature on /dev/sdd1.
        Physical volume "/dev/sdd1" successfully created.
      [[email protected] ~]#
      [[email protected] ~]# pvdisplay
        --- Physical volume ---
        PV Name               /dev/sdb1
        VG Name               StorageVM
        PV Size               3.64 TiB / not usable 22.82 MiB
        Allocatable           yes (but full)
        PE Size               32.00 MiB
        Total PE              119232
        Free PE               0
        Allocated PE          119232
        PV UUID               eI8CPg-2U1K-XT3J-Adx1-he2i-Jbdm-XMVyWV
      
        --- Physical volume ---
        PV Name               /dev/sdc1
        VG Name               StorageVM
        PV Size               1.82 TiB / not usable 16.07 MiB
        Allocatable           yes (but full)
        PE Size               32.00 MiB
        Total PE              59616
        Free PE               0
        Allocated PE          59616
        PV UUID               A7lAbN-0E4I-6eI6-Qdnf-pbt1-vRqq-jkVoZo
      
        "/dev/sdd1" is a new physical volume of "1.82 TiB"
        --- NEW Physical volume ---
        PV Name               /dev/sdd1
        VG Name
        PV Size               1.82 TiB
        Allocatable           NO
        PE Size               0
        Total PE              0
        Free PE               0
        Allocated PE          0
        PV UUID               E3aLPV-KfcM-eeHT-Krlp-r2bi-fRxa-FoBpIg
      
      [[email protected] ~]#
      [[email protected] ~]# pvscan
        PV /dev/sdb1   VG StorageVM       lvm2 [3.64 TiB / 0    free]
        PV /dev/sdc1   VG StorageVM       lvm2 [1.82 TiB / 0    free]
        PV /dev/sdd1                      lvm2 [1.82 TiB]
        Total: 3 [7.28 TiB] / in use: 2 [5.46 TiB] / in no VG: 1 [1.82 TiB]
      [[email protected] ~]#
      step 5- use the vgextend command to extend the volume group StorageVM to include the newly added drive

      Code:
      [[email protected] ~]# vgextend StorageVM /dev/sdd1
        Volume group "StorageVM" successfully extended
      [[email protected] ~]#
      [[email protected] ~]# pvscan
        PV /dev/sdb1   VG StorageVM       lvm2 [3.64 TiB / 0    free]
        PV /dev/sdc1   VG StorageVM       lvm2 [1.82 TiB / 0    free]
        PV /dev/sdd1   VG StorageVM       lvm2 [1.82 TiB / 1.82 TiB free]
        Total: 3 [7.28 TiB] / in use: 3 [7.28 TiB] / in no VG: 0 [0   ]
      [[email protected] ~]#
      step 6- if /storage is mounted unmount it and perform a filesystem check on it
      note- If /storage reports that it is busy and cannot be unmounted you can comment out the /storage line in /etc/fstab and reboot then continue with the steps


      Code:
      [[email protected] ~]# umount /storage
      [[email protected] ~]# fsck -f /dev/StorageVM/lv_storage
      fsck from util-linux 2.28.2
      e2fsck 1.43.3 (04-Sep-2016)
      Pass 1: Checking inodes, blocks, and sizes
      Pass 2: Checking directory structure
      Pass 3: Checking directory connectivity
      Pass 4: Checking reference counts
      Pass 5: Checking group summary information
      /dev/mapper/StorageVM-lv_storage: 22/183140352 files (0.0% non-contiguous), 11835786/1465122816 blocks
      [[email protected] ~]#

      Comment


      • #4
        Part 3.

        step 7- extend the logical volume by the size of the new disk
        we will use the pvdisplay output to get the size value to use in the command


        Code:
        [[email protected] ~]# pvdisplay
          --- Physical volume ---
          PV Name               /dev/sdb1
          VG Name               StorageVM
          PV Size               3.64 TiB / not usable 22.82 MiB
          Allocatable           yes (but full)
          PE Size               32.00 MiB
          Total PE              119232
          Free PE               0
          Allocated PE          119232
          PV UUID               eI8CPg-2U1K-XT3J-Adx1-he2i-Jbdm-XMVyWV
        
          --- Physical volume ---
          PV Name               /dev/sdc1
          VG Name               StorageVM
          PV Size               1.82 TiB / not usable 16.07 MiB
          Allocatable           yes (but full)
          PE Size               32.00 MiB
          Total PE              59616
          Free PE               0
          Allocated PE          59616
          PV UUID               A7lAbN-0E4I-6eI6-Qdnf-pbt1-vRqq-jkVoZo
        
          --- Physical volume ---
          PV Name               /dev/sdd1
          VG Name               StorageVM
          PV Size               1.82 TiB / not usable 16.07 MiB
          Allocatable           yes
          PE Size               32.00 MiB
          Total PE              59616
          Free PE               59616
          Allocated PE          0
          PV UUID               E3aLPV-KfcM-eeHT-Krlp-r2bi-fRxa-FoBpIg
        
        [[email protected] ~]#
        [[email protected] ~]# lvextend -L +1.82TiB /dev/StorageVM/lv_storage
          Rounding size to boundary between physical extents: 1.82 TiB.
          Insufficient free space: 59638 extents needed, but only 59616 available
        [[email protected] ~]# lvextend -L +1.81TiB /dev/StorageVM/lv_storage
          Rounding size to boundary between physical extents: 1.81 TiB.
          Size of logical volume StorageVM/lv_storage changed from 5.46 TiB (178848 extents) to 7.27 TiB (238159 extents).
          Logical volume StorageVM/lv_storage successfully resized.
        [[email protected] ~]#
        step 8- use lvdisplay to confirm that StorageVM reports the combined capacity of all drives

        Code:
        [[email protected] ~]# lvdisplay
          --- Logical volume ---
          LV Path                /dev/StorageVM/lv_storage
          LV Name                lv_storage
          VG Name                StorageVM
          LV UUID                jks6OX-vz7P-Dxfo-7qi3-FUyL-REUG-xLq4YG
          LV Write Access        read/write
          LV Creation host, time sugovbox, 2018-04-22 20:36:18 +1000
          LV Status              available
          # open                 0
          LV Size                7.27 TiB
          Current LE             238159
          Segments               3
          Allocation             inherit
          Read ahead sectors     auto
          - currently set to     256
          Block device           253:0
        
        [[email protected] ~]#

        step 9- use the resize2fs command to extend the file system to the full capacity of the newly
        expanded StorageVM volume


        Code:
        [[email protected] ~]# resize2fs /dev/StorageVM/lv_storage
        resize2fs 1.43.3 (04-Sep-2016)
        Resizing the filesystem on /dev/StorageVM/lv_storage to 1950998528 (4k) blocks.
        The filesystem on /dev/StorageVM/lv_storage is now 1950998528 (4k) blocks long.
        
        [[email protected] ~]#
        the resize2fs command will take some time to complete (about the same amount of time a makefs command would take to create a new filesystem of the added size)


        step 10- remount and reboot
        remount the /storage filesystem and/or uncomment the /storage line in /etc/fstab
        then reboot the server so that the /storage filesystem will be remounted


        Code:
        [[email protected] ~]# mount /storage
        Your system should now have the additional space needed in /storage for continued use.
        Always remember to keep current backups in case of a drive failure.

        Reference :
        https://web.archive.org/web/20150403...orageExpansion
        https://linuxtechlab.com/beginners-guide-resizing-lvm/


        Comment


        • #5
          Originally posted by Wirrunna View Post
          The Expand Storage howto is a bit out of date.
          This update [ATTACH]n1669[/ATTACH] is a follow on from https://www.vortexbox.org/forum/supp...sd-data-on-hdd .

          Thanks for the work updating this. Over the next couple weeks I'll add your step posts to the Wiki as I have time.

          Comment


          • #6
            so to be clear what was 4 commands in the wiki, is now 8000 commands here?

            Comment

            Working...
            X