Moving the persistent storage to different drives/partitions by deleting and (re)creating it; results in unpredictable behavior. Which partition is actuality mounted on /mnt/data seems to be inconsistent, especially after a reboot.
To reproduce:
- Create a setup on a drive with room for persistent storage and at least one extra drive for persistent storage.
- Usually at initial setup storage is setup on the primary drive, if so delete it
- Create a new persistent storage on the secondary drive
- Delete the just created storage
- (re)create a persistent storage on a partition on the primary drive
- Reboot
Expected behavior:
(Only) the 3rd partition on the primary drive is mounted on /mnt/data
Actual behavior:
Nethsec tries to mount all partitions labeled ns-data
root@NethSec:~# lsblk -o name,mountpoint,label,size,uuid
NAME MOUNTPOINT LABEL SIZE UUID
loop0 /overlay rootfs_data 224M 8c25bc4c-ca2c-4844-9f5a-72a72c9140c2
sda 59.5G
└─sda1 /mnt/data ns_data 59.5G 71eb8c0b-500f-499e-9e3a-d33e12a1cedd
nvme0n1 465.8G
├─nvme0n1p1 /boot kernel 16M 1234-ABCD
├─nvme0n1p2 /rom 300M
├─nvme0n1p3 /mnt/data ns_data 465.4G f71d2dee-3682-444d-8824-d98875d61705
└─nvme0n1p128 239K
root@NethSec:~# mount | grep /mnt/data
/dev/nvme0n1p3 on /mnt/data type ext4 (rw,relatime)
/dev/sda1 on /mnt/data type ext4 (rw,relatime)
Cause:
At deleting a persistent storage the (old)partition is only deleted if it is a partition on the primary drive:
|
if [ "$rom_disk" == "$data_disk" ]; then |
Proposed solution:
At deleting a persistent storage on a secondary drive remove the ns-data label and keep the (old)partition to make future analyses of logs possible.
Moving the persistent storage to different drives/partitions by deleting and (re)creating it; results in unpredictable behavior. Which partition is actuality mounted on
/mnt/dataseems to be inconsistent, especially after a reboot.To reproduce:
Expected behavior:
(Only) the 3rd partition on the primary drive is mounted on
/mnt/dataActual behavior:
Nethsec tries to mount all partitions labeled
ns-dataCause:
At deleting a persistent storage the (old)partition is only deleted if it is a partition on the primary drive:
nethsecurity/packages/ns-storage/files/remove-storage
Line 41 in 371e492
Proposed solution:
At deleting a persistent storage on a secondary drive remove the
ns-datalabel and keep the (old)partition to make future analyses of logs possible.