Prerequisites

  • Lightweight cloud creates images and shares them
  • Create a cloud server instance through the image created by the lightweight cloud
  • Create another image for the cloud server created under this image.
  • Create a new bucket as a storage object for image export
  • Download the backed up image through the bucket
  • Import to PVE

Get start

  1. Create an image for the erpnext host in the lightweight cloud
  2. Enable sharing of the image in the region of the instance
  3. Create a cloud server in this region (cloud server - non-lightweight cloud) and select this image
  4. After activation, wait for startup and confirm that the service is normal
  5. Stop the instance and create an image on the current instance (cloud server - not lightweight cloud)
  6. Wait for the image to be created
  7. Come to object storage-bucket list-create bucket
  8. Return to the image in the cloud service and select the image created in step 5.
  9. Select image export in the image options
  10. Select the QCOW2 format when exporting. After the export is completed, it will be stored in the bucket.
  11. Return to object storage - select the bucket list - find the image you just exported - select download image
  12. Download the exported image locally and then import it into PVE.

PVE Import

  1. USB Disk mount
  2. Import qcow2 to vm
  3. Config VM
lsblk

mkdir -p /mnt/usb

mount /dev/sdb1 /mnt/usb

ls /mnt/usb/iso/*.qcow2

## import to vm - qm importdisk <源文件路径> <目标存储ID>

qm importdisk 101 /mnt/usb/iso/vps-backup.qcow2 local-lvm

Return to the PVE interface, add the imported disk to the created empty vm, and set the startup disk.

ERP Next Backup and Restore

Restore

  1. Switch to ERPNext user
  2. Configure backup path, which is in the sites/erpnext/private/backup directory by default
  3. Download the backup data of the source server to the new server
  4. Enter frappe-bench to restore
bench restore 20251231_180001-erpnext-database.sql.gz

//输入mysql root 的密码

//等待3-5 分钟, 就会提示 site ***** has been restored 在前端刷新ui 即可看到新的数据

MySQL change root password

  1. Exit ERPNext user
  2. switch to root
  3. Use root to enter MySQL
  4. Modify the root password through ALTER USER
-- 使用 sudo 以系统管理员身份直接登入 MySQL
sudo mysql -u root

-- 切换到 mysql 库
USE mysql;

-- MariaDB 10.4+:启用密码认证并设置新密码
ALTER USER 'root'@'localhost'
IDENTIFIED VIA mysql_native_password
USING PASSWORD('你的新密码123');

-- 刷新权限并退出
FLUSH PRIVILEGES;
EXIT;

Backup

  1. Just enter frappe-bench and perform backup.
  2. Check backup files
cd frappe-bench

bench backup

ls sites/itiohub.com/private/backups

Reference

Tencent Cloud Server Offline Migration https://cloud.tencent.com/document/product/213/19233

How to backup and restore in Erpnext https://www.youtube.com/watch?v=3qSnwLJmgmg