new: nightbase mig
This commit is contained in:
9
2025-11-13-nightbase-migration/0001-temp-backup.sh
Executable file
9
2025-11-13-nightbase-migration/0001-temp-backup.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 실행 안되면 램 64기가도 없는 허-접
|
||||||
|
sudo mount -t tmpfs -o size=64G tmpfs /tmp/night-tmp --mkdir
|
||||||
|
|
||||||
|
SOURCE_PATH=/x/nvme1/NightBase
|
||||||
|
DESTINATION_PATH=/tmp/night-tmp/NightBase
|
||||||
|
|
||||||
|
sudo rsync -a --info=progress2 $SOURCE_PATH/ $DESTINATION_PATH
|
||||||
27
2025-11-13-nightbase-migration/0002-partition.sh
Executable file
27
2025-11-13-nightbase-migration/0002-partition.sh
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DISK_LABEL="ssd1"
|
||||||
|
DEVICE="/dev/nvme1n1"
|
||||||
|
MOUNT_POINT="/x/nvme1"
|
||||||
|
|
||||||
|
sudo gdisk "$DEVICE" <<EOF
|
||||||
|
o
|
||||||
|
y
|
||||||
|
n
|
||||||
|
1
|
||||||
|
|
||||||
|
|
||||||
|
8300
|
||||||
|
w
|
||||||
|
y
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
PART_DEV="/dev/$(lsblk -ln -o NAME "$DEVICE" | sed -n '2p')"
|
||||||
|
echo "PARTITION: $PART_DEV"
|
||||||
|
|
||||||
|
|
||||||
|
sudo mkfs.btrfs -L "$DISK_LABEL" "$PART_DEV" -f
|
||||||
|
|
||||||
|
sudo mount "$PART_DEV" "$MOUNT_POINT"
|
||||||
6
2025-11-13-nightbase-migration/0003-temp-restore.sh
Executable file
6
2025-11-13-nightbase-migration/0003-temp-restore.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
SOURCE_PATH=/tmp/night-tmp/NightBase
|
||||||
|
DESTINATION_PATH=/x/nvme1/NightBase
|
||||||
|
|
||||||
|
sudo rsync -a --info=progress2 $SOURCE_PATH/ $DESTINATION_PATH
|
||||||
4
2025-11-13-nightbase-migration/README.md
Normal file
4
2025-11-13-nightbase-migration/README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# NightBase Migration
|
||||||
|
|
||||||
|
## Goal
|
||||||
|
- Move NightBase quickly to the other folder.
|
||||||
16
2025-11-13-nightbase-migration/REVIEW.md
Normal file
16
2025-11-13-nightbase-migration/REVIEW.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Review
|
||||||
|
|
||||||
|
## 0001-temp-backup.sh
|
||||||
|
- **CRITICAL**: No validation that tmpfs mount succeeded before rsync
|
||||||
|
- **CRITICAL**: No check that source path exists
|
||||||
|
- **CRITICAL**: No check for sufficient available RAM (64GB required)
|
||||||
|
|
||||||
|
## 0002-partition.sh
|
||||||
|
- **CRITICAL**: Will destroy all data on `/dev/nvme1n1` without confirmation
|
||||||
|
- **CRITICAL**: Variable `$PART_DEV` may fail if lsblk output format differs; needs `/dev/` prefix for mkfs.btrfs
|
||||||
|
- **WARNING**: No validation that device exists before gdisk
|
||||||
|
|
||||||
|
## 0003-temp-restore.sh
|
||||||
|
- **CRITICAL**: No check that source path exists
|
||||||
|
- **CRITICAL**: No validation that destination is mounted/writable
|
||||||
|
- **WARNING**: Will overwrite existing data at destination without confirmation
|
||||||
2
2025-11-13-sata-to-nvme/0001-transfer.sh
Normal file → Executable file
2
2025-11-13-sata-to-nvme/0001-transfer.sh
Normal file → Executable file
@@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
SOURCE_DISK=/dev/nvme0n1p2
|
SOURCE_DISK=/dev/nvme0n1p2
|
||||||
OUTPUT_IMAGE_PATH=/x/sata1/snapshots/nvme-old-1tb.zst
|
OUTPUT_IMAGE_PATH=/x/sata1/snapshots/nvme-old-1tb.zst
|
||||||
TRANSFER_SIZE=436G
|
|
||||||
|
|
||||||
sudo partclone.ntfs -c -s $SOURCE_DISK -o - \
|
sudo partclone.ntfs -c -s $SOURCE_DISK -o - \
|
||||||
| pv -s $TRANSFER_SIZE -pterb \
|
|
||||||
| zstd -T0 -19 -o $OUTPUT_IMAGE_PATH
|
| zstd -T0 -19 -o $OUTPUT_IMAGE_PATH
|
||||||
|
|
||||||
|
|||||||
6
2025-11-13-sata-to-nvme/0002-rollback-fuck.sh
Executable file
6
2025-11-13-sata-to-nvme/0002-rollback-fuck.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DEST_DISK=/dev/nvme1n1p1
|
||||||
|
INPUT_IMAGE_PATH=/x/ssd1/snapshots/nvme-old-1tb.zst
|
||||||
|
|
||||||
|
zstd -dc -T0 $INPUT_IMAGE_PATH | sudo partclone.ntfs -r -s - -o $DEST_DISK
|
||||||
11
AGENT.md
Normal file
11
AGENT.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Sysadmin Sessions
|
||||||
|
|
||||||
|
## The Purpose
|
||||||
|
This repository is created to achieve stable system management and avoid mistakes systematically.
|
||||||
|
|
||||||
|
## Guideline
|
||||||
|
1. Review the scripts in a given folder, and append to REVIEW.md
|
||||||
|
2. Do not assess any styles or add QoL recommendation.
|
||||||
|
3. Keep the review as short as possible.
|
||||||
|
4. Aim roughly to prevent critical `rm -rf`. This is not a vitamin, but a painkiller.
|
||||||
|
5. Keep REVIEW.md, and detect fixes. So you can append REVIEW.md with fixes and changes.
|
||||||
Reference in New Issue
Block a user