서버 정보

SMCi/IR6028hostnamespecmemo
2019000738143-u16-siot

E5-2680 v4 2.40GHz (14C 28T) 2ea

DDR4 192GB (2400MHz 16GB 2R 8ea)

sd{a,b} INTEL SSD 480G8

sd{c,d} Seagate ST8000VN004 8TB

10GbT Onboard ( X10DRI-T )

DS19A7S9004
2019000739144-u20-siotDS19A7S9003


백업

143-u16-siot 서버

# hostname
143-u16-siot

# cat /etc/network/interfaces
auto em1
iface em1 inet static
address 150.xxx.yyy.143
netmask 255.255.255.192
network 150.xxx.yyy.128
broadcast 150.xxx.yyy.191
gateway 150.xxx.yyy.129
dns-nameservers 134.75.30.1

# free -h
              total        used        free      shared  buff/cache   available
Mem:           125G        1.4G        111G         25M         12G        123G
Swap:          127G          0B        127G

# top
top - 18:18:30 up 44 days,  7:11,  9 users,  load average: 0.00, 0.01, 0.02
Tasks: 521 total,   1 running, 520 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 13191679+total, 11733267+free,  1424996 used, 13159128 buff/cache
KiB Swap: 13410304+total, 13410304+free,        0 used. 12973902+avail Mem

# cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.7 LTS (Xenial Xerus)"

# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 447.1G  0 disk
├─sda1   8:1    0 319.2G  0 part /
├─sda2   8:2    0     1K  0 part
└─sda5   8:5    0 127.9G  0 part [SWAP]
sdb      8:16   0 447.1G  0 disk
└─sdb1   8:17   0 447.1G  0 part /data
sdc      8:32   0   7.3T  0 disk
sdd      8:48   0   7.3T  0 disk

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       315G  5.5G  293G   2% /
/dev/sdb1       440G   71M  418G   1% /data

# ls -al /data
total 24
drwxr-xr-x  3 root root  4096 Jul 12  2019 .
drwxr-xr-x 24 root root  4096 Aug 29 15:19 ..
drwx------  2 root root 16384 Jul 12  2019 lost+found

# boot using ubuntu 20 desktop image > live
# update apt repo
# apt install dump

# mkdir /mnt/143
# mount /dev/sda1 /mnt/143
# dd if=/dev/zero of=/mnt/143/zerofile bs=1G
# rm /mnt/143/zerofile
# umount /mnt/143

# shirink partition using gparted
# lsblk /dev/sda
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 447.1G  0 disk
├─sda1   8:1    0    10G  0 part /
├─sda2   8:2    0     1K  0 part
└─sda5   8:5    0 127.9G  0 part [SWAP]

# dump -0uf /data/143-u16-siot-sda1-ext4.dump /dev/sda1
  DUMP: Date of this level 0 dump: Thu Oct 12 19:58:42 2023
  DUMP: Dumping /dev/sda1 (/) to /data/143-u16-siot-sda1-ext4.dump
  DUMP: Label: none
  DUMP: Writing 10 Kilobyte records
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 5835803 blocks.
  DUMP: Volume 1 started with block 1 at: Thu Oct 12 19:58:43 2023
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: Closing /data/143-u16-siot-sda1-ext4.dump
  DUMP: Volume 1 completed at: Thu Oct 12 19:59:08 2023
  DUMP: Volume 1 5804480 blocks (5668.44MB)
  DUMP: Volume 1 took 0:00:25
  DUMP: Volume 1 transfer rate: 232179 kB/s
  DUMP: 5804480 blocks (5668.44MB) on 1 volume(s)
  DUMP: finished in 25 seconds, throughput 232179 kBytes/sec
  DUMP: Date of this level 0 dump: Thu Oct 12 19:58:42 2023
  DUMP: Date this dump completed:  Thu Oct 12 19:59:08 2023
  DUMP: Average transfer rate: 232179 kB/s
  DUMP: DUMP IS DONE

# scp 143-u16-siot-sda1-ext4.dump 191-u20-restore:~

144-u20-siot 서버

# hostname
144-u20-siot

# cat /etc/network/interfaces
auto eno1
iface eno1 inet static
address 150.xxx.yyy.144
netmask 255.255.255.192
network 150.xxx.yyy.128
broadcast 150.xxx.yyy.191
gateway 150.xxx.yyy.129
dns-nameservers 134.75.30.1

# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"

# free -h
              total        used        free      shared  buff/cache   available
Mem:          125Gi       4.6Gi        72Gi       3.0Mi        48Gi       121Gi
Swap:         127Gi          0B       127Gi

# top
top - 18:18:57 up 44 days,  6:33,  3 users,  load average: 0.00, 0.07, 0.14
Tasks: 571 total,   1 running, 570 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.1 us,  0.2 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem : 128811.3 total,  74374.8 free,   4752.9 used,  49683.6 buff/cache
MiB Swap: 130960.0 total, 130960.0 free,      0.0 used. 124245.5 avail Mem

# lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda       8:0    0 447.1G  0 disk
├─sda1    8:1    0 319.2G  0 part  /
├─sda2    8:2    0     1K  0 part
└─sda5    8:5    0 127.9G  0 part  [SWAP]
sdb       8:16   0 447.1G  0 disk
└─sdb1    8:17   0 447.1G  0 part  /data
sdc       8:32   0   7.3T  0 disk
└─sdc1    8:33   0   7.3T  0 part
  └─md1   9:1    0   7.3T  0 raid1 /sensordata
sdd       8:48   0   7.3T  0 disk
└─sdd1    8:49   0   7.3T  0 part
  └─md1   9:1    0   7.3T  0 raid1 /sensordata

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       315G   22G  277G   8% /
/dev/sdb1       440G   71M  418G   1% /data
/dev/md1        7.3T  271M  6.9T   1% /sensordata

# ls -al /data
total 24
drwxr-xr-x  3 root root  4096 Jul 12  2019 .
drwxr-xr-x 24 root root  4096 Aug 29 15:19 ..
drwx------  2 root root 16384 Jul 12  2019 lost+found

# boot using ubuntu 20 desktop image > live
# update apt repo
# apt install dump

# after resize partion using gparted
# lsblk /dev/sda
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 447.1G  0 disk
├─sda1   8:1    0    25G  0 part /
├─sda2   8:2    0     1K  0 part
└─sda5   8:5    0 127.9G  0 part [SWAP]

# dump -0uf /data/144-u20-siot-sda1-ext4.dump /dev/sda1

# finding missing file
# mount /dev/sda1 /mnt/144
# cd /mnt/144
# tar cvf 144-u20-siot-sda1-missing.tar \
./root/the-things-stack/.env/data/cockroach/logs/cockroach.1c6de5250b5c.root.2021-06-02T01_23_17Z.000001.log \
./root/the-things-stack/.env/data/cockroach/logs/cockroach-pebble.84cf7ca90fe7.root.2021-06-02T01_28_31Z.000001.log \
./root/.cache/go-build/5f/5fb6bae581d50f79d52eb63a20fa0b0d0b160445f689f7426f91015bbfcc943c-a \
./root/go/lorawan-stack/.env/data/cockroach/logs/heap_profiler/memprof.2021-06-01T08_04_27.767.25543160.pprof \
./root/go/lorawan-stack/.env/data/cockroach/MANIFEST-000021
 
# scp 144-u20-siot-sda1-ext4.dump 191-u20-restore:~
# scp 144-u20-siot-sda1-missing.tar 191-u20-restore:~

복원

1) 인스턴스에 해당하는 OS의 클라우드 이미지 다운로드

2) 부팅된 하이퍼바이에 클라우드 이미지 attach 하고 expand

3) attach 한 이미지의 루트 내용 삭제

4) 파일시스템 덤프파일을 restore 하기

5) missing 파일 찾아서 복사하기

6) 디스크의 UUID 복원하기 (fstab, grub에서 참고함)

7) 해당 디스크를 인스턴스에서 detach 하고, 다른 인스턴스에 붙여 부팅하기

# hostname
191-u20-restore

# mount ubuntu 16 cloud image on sdb on oVirt
# mount ubuntu 20 cloud image on sdc on oVirt
# expand sdb, sdc on oVirt
# growpart /dev/sdb 1
# e2fsck -f /dev/sdb1
# resize2fs /dev/sdb1
# growpart /dev/sdc 1
# e2fsck -f /dev/sdc1
# resize2fs /dev/sdc1

# mkdir /mnt/{143,144}
# mount /dev/sdb1 /mnt/143
# mount /dev/sdc1 /mnt/144
# rm -rf /mnt/14*/*

# lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda       8:0    0   50G  0 disk
├─sda1    8:1    0 49.9G  0 part /
├─sda14   8:14   0    4M  0 part
└─sda15   8:15   0  106M  0 part /boot/efi
sdb       8:16   0   20G  0 disk
└─sdb1    8:17   0   20G  0 part /mnt/143
sdc       8:32   0   30G  0 disk
├─sdc1    8:33   0 29.9G  0 part /mnt/144
├─sdc14   8:46   0    4M  0 part
└─sdc15   8:47   0  106M  0 part

# cd /mnt/143
# restore -rf /root/143-u16-siot-sda1-ext4.dump

# cd /mnt/144
# restore -rf /root/144-u20-siot-sda1-ext4.dump
expected next file 385943, got 0
./root/the-things-stack/.env/data/cockroach/logs/cockroach.1c6de5250b5c.root.2021-06-02T01_23_17Z.000001.log: (inode 385943) not found on tape
expected next file 385964, got 0
./root/the-things-stack/.env/data/cockroach/logs/cockroach-pebble.84cf7ca90fe7.root.2021-06-02T01_28_31Z.000001.log: (inode 385964) not found on tape
expected next file 385978, got 0
./root/.cache/go-build/5f/5fb6bae581d50f79d52eb63a20fa0b0d0b160445f689f7426f91015bbfcc943c-a: (inode 385978) not found on tape
expected next file 421105, got 0
./root/go/lorawan-stack/.env/data/cockroach/logs/heap_profiler/memprof.2021-06-01T08_04_27.767.25543160.pprof: (inode 421105) not found on tape
expected next file 421545, got 0
./root/go/lorawan-stack/.env/data/cockroach/MANIFEST-000021: (inode 421545) not found on tape

# cd /mnt/144
# tar xvf /root/144-u20-siot-sda1-missing.tar -C .
./root/the-things-stack/.env/data/cockroach/logs/cockroach.1c6de5250b5c.root.2021-06-02T01_23_17Z.000001.log
./root/the-things-stack/.env/data/cockroach/logs/cockroach-pebble.84cf7ca90fe7.root.2021-06-02T01_28_31Z.000001.log
./root/.cache/go-build/5f/5fb6bae581d50f79d52eb63a20fa0b0d0b160445f689f7426f91015bbfcc943c-a
./root/go/lorawan-stack/.env/data/cockroach/logs/heap_profiler/memprof.2021-06-01T08_04_27.767.25543160.pprof
./root/go/lorawan-stack/.env/data/cockroach/MANIFEST-000021


# cat /mnt/143/etc/fstab | grep -v '#' | grep /
UUID=98744ffe-c1f2-426a-96be-02f7b60a2052  /  ext4  errors=remount-ro 0  1

# cat /mnt/144/etc/fstab | grep -v '#' | grep /
UUID=41baac91-db90-4271-8968-e82051c3661f  /  ext4  errors=remount-ro 0  1

# blkid
/dev/sdb1: LABEL="cloudimg-rootfs" UUID="54662b82-0ae8-45c6-a2e0-52a5f9e05dd8" TYPE="ext4" PARTUUID="b38fe82f-01"
/dev/sdc1: LABEL="cloudimg-rootfs" UUID="87d1ae31-456c-411b-8569-a016d5c7ff42" TYPE="ext4" PARTUUID="5dfc458a-7e7c-44b8-86f5-2f8b4a1e6345"

# umount /mnt/143
# umount /mnt/144

# tune2fs -U 98744ffe-c1f2-426a-96be-02f7b60a2052 /dev/sdb1 
# tune2fs -U 41baac91-db90-4271-8968-e82051c3661f /dev/sdc1

# blkid
/dev/sdb1: LABEL="cloudimg-rootfs" UUID="98744ffe-c1f2-426a-96be-02f7b60a2052" TYPE="ext4" PARTUUID="b38fe82f-01"
/dev/sdc1: LABEL="cloudimg-rootfs" UUID="41baac91-db90-4271-8968-e82051c3661f" TYPE="ext4" PARTUUID="5dfc458a-7e7c-44b8-86f5-2f8b4a1e6345"