Skip to content

Instantly share code, notes, and snippets.

@oldarmyc
Created November 28, 2018 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oldarmyc/1cd545dcd4461bbeb43ac6331a1ae8be to your computer and use it in GitHub Desktop.
Save oldarmyc/1cd545dcd4461bbeb43ac6331a1ae8be to your computer and use it in GitHub Desktop.
Move/replace /var/lib/gravity

Changing out /var/lib/gravity

In the example below /dev/sdb was presented to the VM. You would use whatever disk was presented in your setup.

  1. Get the disks presented to the system
fdisk -l
  1. Create the partition on the disk. Using fdisk but you can use others i.e. gdisk
fdisk /dev/sdb
Type **n** for new partition and you can take the defaults to the end.

Type **p** for print and make sure that everything is good, and then press **w** to write the changes.
  1. Format the partition using xfs and ensure d_type is supported.
mkfs.xfs -n ftype=1 /dev/sdb1
  1. Mount the partition to a temp location so we can move files
mount /dev/sdb1 /mnt
  1. Before we start the work ensure that all of the sessions have had the work saved and committed, and the sessions stopped.

  2. Stop gravity on the server

systemctl stop gravity__gravitational.io__planet-dbtools__5.1.4-1906-2.service
systemctl stop gravity__gravitational.io__teleport__2.4.7.service
  1. Disable the services so that things do not start up while work is being done
systemctl disable gravity__gravitational.io__planet-dbtools__5.1.4-1906-2.service
systemctl disable gravity__gravitational.io__teleport__2.4.7.service
  1. Start the copy of the files
cd /mnt
cp -av /var/lib/gravity .
  1. After the copy is done need to move the files up one directory
cd /mnt/gravity
cp * ../
  1. Move out of the directory and unmount
cd
umount /mnt
  1. Edit the /etc/fstab file to permanently create the new mount point. If there is an existing mount for /var/lib/gravity comment it out, and set up the new mount point similar to the below example.

    # Adding the line below in the /etc/fstab file
    /dev/sdb1       /var/lib/gravity        xfs     defaults,noatime,nodiratime 0 0
  2. Mount the mounts and check to ensure the /etc/fstab file is good to go.

mount -a
  1. Check to make sure you see the mount /var/lib/gravity using /dev/sdb1
df -h
  1. Enable and start gravity back up
systemctl enable gravity__gravitational.io__planet-dbtools__5.1.4-1906-2.service
systemctl enable gravity__gravitational.io__teleport__2.4.7.service
systemctl start gravity__gravitational.io__planet-dbtools__5.1.4-1906-2.service
systemctl start gravity__gravitational.io__teleport__2.4.7.service
  1. Enter gravity and make sure that things start up properly
gravity enter
watch kubectl get pods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment