Nextcloud Migration

# Prep

## Doc

### Sares

Shares mit Marina, Links sind bekannt

![Alternativtext](./ncp-shares.png)

### NCP Interne Mounts (disk, usb)

Fstab:

[fstab](./ncp_fstab)

Dateistruktur df -h:

[ncp_df-h.out](./ncp_df-h.out)

### NCP Externe Mounts (shared)

#### media (Plex)
df -h
```
Filesystem                                                                    Size  Used Avail Use% Mounted on
tmpfs                                                                         197M  1.2M  196M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv                                              20G   16G  2.6G  87% /
tmpfs                                                                         982M     0  982M   0% /dev/shm
tmpfs                                                                         5.0M     0  5.0M   0% /run/lock
/dev/sda2                                                                     974M  258M  650M  29% /boot
nextcloudpi.home:/media/data/ncdata/data/christopher.kolb/files/06_Downloads  3.9T  766G  3.0T  21% /media/Downloads
tmpfs                                                                         197M  4.0K  197M   1% /run/user/1000
```
fstab
```
/dev/disk/by-id/dm-uuid-LVM-35WbgBk3cPUcGbiHIztiy0kxZgdM7DC3kNcI5PKdGKFO4gw8sZmnmRdkgAfxoPtn / ext4 defaults 0 0
# /boot was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/1ec04a96-472a-4784-b53e-5757c85af647 /boot ext4 defaults 0 0
/swap.img       none    swap    sw      0       0
#//10.10.10.11/ncp-christopher.kolb/06_Downloads        /media/Downloads        cifs    credentials=/home/ck/.smbfile,rw,user,uid=1000,gid=1000,file_mode=0766,dir_mode=0777    0       0
nextcloudpi.home:/media/data/ncdata/data/christopher.kolb/files/06_Downloads  /media/Downloads  nfs  rw,sync,vers=4,_netdev  0  0
#//192.168.178.131/ncp-christopher.kolb/06_Downloads    /media/Downloads        cifs    credentials=/home/ck/.smbfile,rw,user   0       0
```
#### sabnzbd (*arr)
df -h
```
Filesystem                                                                    Size  Used Avail Use% Mounted on
tmpfs                                                                         197M  1.4M  196M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv                                              30G   19G  9.2G  68% /
tmpfs                                                                         984M     0  984M   0% /dev/shm
tmpfs                                                                         5.0M     0  5.0M   0% /run/lock
/dev/sda2                                                                     2.0G  198M  1.6G  11% /boot
nextcloudpi.home:/media/data/ncdata/data/christopher.kolb/files/06_Downloads  3.9T  766G  3.0T  21% /media/Downloads
tmpfs                                                                         197M   12K  197M   1% /run/user/1000
```
fstab
```
/dev/disk/by-id/dm-uuid-LVM-ysgEIBdrHVAktsjID8kATTfBFNNDns5boot4pzjSAUcGh39MBZOk1euQVAnGdygJ / ext4 defaults 0 1
# /boot was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/06427371-d5b3-4b5f-be67-5428c1ba4068 /boot ext4 defaults 0 1
/swap.img       none    swap    sw      0       0
nextcloudpi.home:/media/data/ncdata/data/christopher.kolb/files/06_Downloads  /media/Downloads  nfs  rw,sync,vers=4,_netdev  0  0
```
#### immich (images, Backup)
df -h
```
Filesystem                                                                         Size  Used Avail Use% Mounted on
tmpfs                                                                              392M  1.4M  391M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv                                                   97G   47G   45G  52% /
tmpfs                                                                              2.0G     0  2.0G   0% /dev/shm
tmpfs                                                                              5.0M     0  5.0M   0% /run/lock
/dev/sda2                                                                          2.0G  104M  1.7G   6% /boot
ck@nextcloudpi:/media/data/ncdata/data/christopher.kolb/files/04_Medien/02 Reisen  1.5T  951G  460G  68% /home/ck/immich-app/Reisen
ck@nextcloudpi:/media/data/ncdata/data/christopher.kolb/files/Kamera-Uploads       1.5T  951G  460G  68% /home/ck/immich-app/Kamera-Uploads
ck@nextcloudpi:/media/data/ncdata/data/christopher.kolb/files/03_Dateien/Oma       1.5T  951G  460G  68% /home/ck/immich-app/Oma
ck@nextcloudpi:/media/data/ncdata/data/christopher.kolb/files/03_Dateien/Opa       1.5T  951G  460G  68% /home/ck/immich-app/Opa
ck@nextcloudpi:/media/data/ncdata/data/christopher.kolb/files/Backup/immich        1.5T  951G  460G  68% /home/ck/immich-app/library/backups
tmpfs                                                                              392M   12K  392M   1% /run/user/1000
```
fstab
```
/dev/disk/by-id/dm-uuid-LVM-hVZIgMu9dGnCwyY6HqRkS50pee2f8fi2ji67MdfkhBD03E8kv7QVRmgFsTCSYKjP / ext4 defaults 0 1
# /boot was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/d949b302-7e4f-4317-a696-12d4a518f110 /boot ext4 defaults 0 1
/swap.img       none    swap    sw      0       0
ck@nextcloudpi:/media/data/ncdata/data/christopher.kolb/files/Kamera-Uploads /home/ck/immich-app/Kamera-Uploads fuse.sshfs _netdev,allow_other,IdentityFile=/home/ck/.ssh/id_ed25519,reconnect,x-systemd.automount,uid=1000,gid=1000,idmap=user  0  0
ck@nextcloudpi:/media/data/ncdata/data/christopher.kolb/files/Backup/immich /home/ck/immich-app/library/backups fuse.sshfs _netdev,allow_other,IdentityFile=/home/ck/.ssh/id_ed25519,reconnect,x-systemd.automount,uid=1000,gid=1000,idmap=user  0  0
ck@nextcloudpi:/media/data/ncdata/data/christopher.kolb/files/04_Medien/02\040Reisen /home/ck/immich-app/Reisen fuse.sshfs ro,_netdev,allow_other,IdentityFile=/home/ck/.ssh/id_ed25519,reconnect,x-systemd.automount,uid=1000,gid=1000,idmap=user  0  0
ck@nextcloudpi:/media/data/ncdata/data/christopher.kolb/files/03_Dateien/Oma /home/ck/immich-app/Oma fuse.sshfs ro,_netdev,allow_other,IdentityFile=/home/ck/.ssh/id_ed25519,reconnect,x-systemd.automount,uid=1000,gid=1000,idmap=user  0  0
ck@nextcloudpi:/media/data/ncdata/data/christopher.kolb/files/03_Dateien/Opa /home/ck/immich-app/Opa fuse.sshfs ro,_netdev,allow_other,IdentityFile=/home/ck/.ssh/id_ed25519,reconnect,x-systemd.automount,uid=1000,gid=1000,idmap=user  0  0
```

#### vaultwarden (Backup)
df -h
```
Filesystem                                                                        Size  Used Avail Use% Mounted on
tmpfs                                                                             197M  1.2M  196M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv                                                  28G  5.4G   21G  21% /
tmpfs                                                                             984M     0  984M   0% /dev/shm
tmpfs                                                                             5.0M     0  5.0M   0% /run/lock
/dev/sda2                                                                         2.0G  102M  1.7G   6% /boot
ck@nextcloudpi:/media/data/ncdata/data/christopher.kolb/files/Backup/vaultwarden  1.5T  951G  460G  68% /home/ck/dc-vaultwarden/backup
tmpfs                                                                             197M   12K  197M   1% /run/user/1000
```
fstab
```
/dev/disk/by-id/dm-uuid-LVM-Vwa7BhYb5Wlskgm6GusYRpA3znI0Iw8tyrAP3oO96TJ4S8g0BOO2Qo2UCnduM0fA / ext4 defaults 0 1
# /boot was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/acf39e1b-030c-4f18-bdac-75820d4f7b3f /boot ext4 defaults 0 1
/swap.img       none    swap    sw      0       0
ck@nextcloudpi:/media/data/ncdata/data/christopher.kolb/files/Backup/vaultwarden /home/ck/dc-vaultwarden/backup fuse.sshfs _netdev,allow_other,IdentityFile=/home/ck/.ssh/id_ed25519,reconnect,x-systemd.automount,uid=1000,gid=1000,idmap=user 0 0
```

TODO: 
- proxy (Backup)
- plex (Backup)
- 


### Eingesetzte NC Apps
- Activities for shared file downloads
- Archive Manager
- Doom

### Eingesetzte NCP Services - Challenges?
ncp included NFS wurde genutzt um plex, *arr und sabnzbd zu connecten.
Alternativen:
- nfs container
- sshfs (Rechteproblem?)


### VM lokale hacks

Wireguard nach WZ
[wg0.conf](./wg/wg0.conf)

Rsync cron job
crontab:
```
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
 0  *   *   *   * root    /bin/bash /home/ck/reresolve-dns.sh >> /home/ck/log
 0  1   *   *   * root    timeout 1h /home/ck/cron-rsync.sh >> /home/ck/log
```

# hier weiter machen

## Klären

### Nextcloudpi wiederherstellbar runterfahren

### NC Mounts

Ordnerstruktur Ziel allgemein auf nextcloud VM

Wohin mounten

Nextcloud mounts mit hardlinks zu backup folder etc.?

### Git einrichten

Doku dort veröffentlichen

Repos zu:

- Rsync job

## Kommunikation

Marina

Polska

# Migration Umsetzung

## nextcloudpi in wartungsmodus (reicht?)

## Alle externen Mounts abschalten

## Daten umhängen

### Virtuelle Disk

Ownership der VM ändern in Proxmox

### USB Disk

Entsprechend mounten

# Nach Migration

## Shares

\- Filme und Serien

\- Der letzte Bulle Mama

\- Chrissiflix an DoJo

\- Kalender in Polska

## Mounts

Externe mounts anpassen

## Anbindung

Nextcloud Apps

- Chrissi Handy
- Marina Handy
- Surface
- iPhone?

Handy Notes Apps auch Marina

\- Apps

\- Alle Mounts wiederherstellen

## rsync-backup
Als Container laufne lassen?
repo pullen
wg einrichten
pfade zu scripten in cron anpassen
pfade in scripten zu daten anpassen
scripte testen
cron einichten

## Settings
2FA

## Hygiene
ncp ausschalten
Domain auf k3in.de ändern: [link](https://github.com/nextcloud/all-in-one?tab=readme-ov-file#how-to-change-the-domain)
gitea backup in nextcloud backup struktur aufnehmen (mount? symlink auf output?) --> dokumentieren!