Systools Index

Storage

Moving partitions

        var
        (parted) mkpart primary ext4 57GiB 200GiB
        
        swap
        (parted) mkpart primary linux-swap 29GiB 57GiB
        
        home
        (parted) mkpart primary ext4 57GiB 200GiB
        
        srv
        (parted) mkpart primary ext4 200GiB 100%
        

Reboot into single-user mode where services aren't started and networking is offline.

        # init 1
        

Copy the data:

cp -apx /srv/* /mnt/srv

Rename directory, for later backup;

        mv /srv /srv.old
        mkdir /srv
        

Edit the /etc/fstabfile:

        # Server Data /srv
        UUID=6fadcb98-e442-4af7-a5f2-1ddb6100a8c4 /srv            ext4    defaults        0       2
        

Reboot in normal mode.

1.2. LVM

Read Raid Setup, the only thing you will need outside system is: "Patience, Pizza, and your favorite caffeinated beverage.". Arch Wiki article about Sofware RAID and LVM.

Basic idea behind RAID is to deal with independent disks as an array of drives. Raid 0 uses two or more disks as one, with performance gains without fault-tolerance. From raid 1 to 6 they offer diferent fault tolerance mechanisms.

LVM or Logic Volume Manager bring one more layer, read Lvm made easy. Partitions under lvm are easy to be resized, moved and there is a tool to help encrypt. There is more freedom to name physical disk names exp; production, development, backups...

Until now "from install" there is only one partition, it is good idea to have a system with diferent partitions for each propos. If is a "fresh install";

        # cd /iso/crux/opt/
        # pkgadd lvm2#2.02.107-1.pkg.tar.xz
        #
        

Multiple Partition

Create a LVM partition, fdisk should show something like this;

        # fdisk /dev/sdb

        Welcome to fdisk (util-linux 2.26.1).
        Changes will remain in memory only, until you decide to write them.
        Be careful before using the write command.


        Command (m for help): p
        Disk /dev/sdb: 232.9 GiB, 250059350016 bytes, 488397168 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: E37FE96F-9845-45A4-B6DA-BF3F8E47511A

        Device     Start      End  Sectors  Size Type
        /dev/sdb1   2048     8056     6009    3M BIOS boot
        /dev/sdb2   8192 18440191 18432000  8.8G Linux filesystem

        Command (m for help):
        
*.o
*.exe
*.dll
*.so
*.zip
*.iss
nimcache
lib/nimcache
tools/nimcache
tests/nimcache
tests/accept/run/nimcache
tests/accept/compile/nimcache
tests/reject/nimcache
rod/nimcache
rod/c2nim/nimcache
rod/pas2nim/nimcache
rod/tinyc
misc
doc/*.html
web/upload/*.html
home/pkgmk/packages/* /var/ports/packages/ # rm -R /home/pkgmk # usermod -d /var/ports pkgmk

Check ownership, you may need recursive if partition has bin used on another system.

        # chown pkgmk:pkgmk /var/ports/distfiles
        # chown pkgmk:pkgmk /var/ports/packages
        #
        
        # mkdir /home/tmp
        # mount /dev/homevg/homelv /home/tmp
        # mv /home/user /home/tmp
        # umount /home/tmp
        # rmdir /home/tmp
        # rm -R /home/user
        

Maintenance

        # smartctl -t long /dev/sdb1
        # smartctl -a /dev/sdb1 | less
        

Non Destructive Test;

        # badblocks -nsv /dev/sdb1
        

Example gitolite volume

Lets create new lvm volume for repositories data;

        # lvcreate -L 15G -n gitlv homevg
          Logical volume "gitlv" created.

        # mkfs.ext4 /dev/homevg/gitlv
         mke2fs 1.42.12 (29-Aug-2014)
         Creating filesystem with 3932160 4k blocks and 983040 inodes
         Filesystem UUID: 54c7dca5-1558-4f90-8d81-c01e4e50c6ae
         Superblock backups stored on blocks:
                 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

         Allocating group tables: done
         Writing inode tables: done
         Creating journal (32768 blocks): done
         Writing superblocks and filesystem accounting information: done

         #
        

Edit fstab

        UUID=54c7dca5-1558-4f90-8d81-c01e4e50c6ae       /srv/git                ext4 defaults,noatime   0 2
        

1.3. BTRFS

Systools Index

This is part of the c9-doc Manual. Copyright (C) 2016 Silvino Silva. See the file Gnu Free Documentation License for copying conditions.