Skip to content

Instantly share code, notes, and snippets.

@JorgeMGuimaraes
Created November 29, 2022 02:17
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 JorgeMGuimaraes/de2a52833e9bceb0f9993add97267d63 to your computer and use it in GitHub Desktop.
Save JorgeMGuimaraes/de2a52833e9bceb0f9993add97267d63 to your computer and use it in GitHub Desktop.

Move or Relocate /var Directory to a New Partition in Linux

Move or Relocate /var Directory to a New Partition in Linux

References

Switch to single-user mode

sudo init 1

Partitioning and Creating FS

fdisk /dev/sdb
Command (m for help): p
Command (m for help): g
Command (m for help): n, Enter, Enter, Enter
Command (m for help): w

mkfs.ext4 /dev/sdb1

Moving /var

mkdir -p /media/newvar
cp -apx /var/* /media/newvar
mv /var /var.old
mkdir /var

blkid >> /etc/fstab
nano /etc/fstab

Reboot System

reboot
#or
systemctl reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment