Setting global conda source for all users
## config below file to set conda's global source
[root@mgt ~]$ ls /opt/ohpc/pub/apps/miniconda3/.condarc
/opt/ohpc/pub/apps/miniconda3/.condarc
## using Tsinghua's conda source
[root@mgt ~]$ cat /opt/ohpc/pub/apps/miniconda3/.condarc
auto_activate_base: true
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
# original
# channels:
# - conda-forge
# - defaults
Comments: 0
Jan 19, 2021 | 3370 views
Using rsync (not verified yet)
Backup host:/ to /backup/root/
### Markdown partition info
[root@mgt ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.1G 0 disk
\u251c\u2500sda1 8:1 0 200M 0 part /boot/efi
\u251c\u2500sda2 8:2 0 1G 0 part /boot
\u2514\u2500sda3 8:3 0 221.9G 0 part
\u251c\u2500centos-root 253:0 0 50G 0 lvm /
\u251c\u2500centos-swap 253:1 0 4G 0 lvm [SWAP]
\u2514\u2500centos-home 253:2 0 167.9G 0 lvm
[root@mgt ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 189G 0 189G 0% /dev
tmpfs 189G 0 189G 0% /dev/shm
tmpfs 189G 20M 189G 1% /run
tmpfs 189G 0 189G 0% /sys/fs/cgroup
/dev/mapper/centos-root 50G 37G 14G 74% /
/dev/sda2 1014M 170M 845M 17% /boot
/dev/sda1 200M 12M 189M 6% /boot/efi
### Backup
## remove --dry-run after everything is good to start backup OS
sudo rsync -aAXv --dry-run --exclude=/dev/* --exclude=/proc/* \
--exclude=/sys/* --exclude=/tmp/* --exclude=/run/* --exclude=/mnt/* \
--exclude=/media/* --exclude="swapfile" --exclude="lost+found" --exclude=".cache" \
--exclude="Downloads" --exclude=".VirtualBoxVMs"--exclude=".ecryptfs" \
host:/ /backup/root/
### Use a Live USB boot into rescue with network enabled
### Format /dev/sda to Create the filesystems and configure LVM
...
# then
mount /dev/mapper/centos-root to /mnt/
mount /dev/sda2 /mnt/boot/
mount /dev/sda1 /mnt/boot/efi/
...
### Mount NFS to /backup
### Restore
rsync -aAXv --delete --exclude="lost+found" /backup/root/ /mnt/
### Mount the required folders and chroot into /mnt
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc/ /mnt/proc
chroot /mnt/
### Install grub
grub2-install /dev/sda
### Update the fstab as the UUID for the boot partion is now incorrect
# list block device UUID
blkid
vi /etc/fstab
### Regenerate the grub config file
grub2-mkconfig -o /boot/grub2/grub.cfg
### Exit chroot and unmount the folders
exit
umount /mnt/dev/
umount /mnt/sys/
umount /mnt/proc/
umount /mnt/boot/
### Your network interface will probably get renamed as the MAC address will be different
### reboot
Using dd
## check mounted NFS
[root@mgt ~]# showmount -e host182
Export list for host182:
/backup *
[root@mgt ~]# df -h | grep host
host182:/backup 530G 34G 469G 7% /backup
## Create the image. Make sure you have enough bandwidth available.
dd if=/dev/sda of=/backup/sda_disk.img
## Use a USB to boot into rescue mode with network enabled
## Mount above NFS on /backup
## Restore sda using disk image backup.
dd if=/backup/sda_disk.img of=/dev/sda
How to mount an dd image of a partition
Note: Whole disk with more than one partition cannot be mounted, i.e. a dd image of a file system can be mounted only.
## commands to mount a dd image of a filesystem
mount -o loop ./boot_sda1.dd /backup/sda
[root@xxx /backup]$ mount | grep boot
/dev/sda1 on /boot type ext4 (rw,relatime,data=ordered)
/backup/boot_sda1.dd on /backup/sda type ext4 (rw,relatime,data=ordered)
[root@xxx /backup]$ lsblk | grep boot
\u251c\u2500sda1 8:1 0 600M 0 part /boot
[root@xxx /backup]$ ls -lh boot_sda1.dd
-rw-r--r-- 1 root root 600M Jan 28 11:31 boot_sda1.dd
Reference
Comments: 0