Skip to content

Conversation

onethree7
Copy link
Contributor

✍️ Description

Script would allow user to choose to delete an active thinpool with volumes under it:
-> Issue, system thinpool called "data" is excluded here
if [[ "$lv" == "data" || "$lv" == "root" || "$lv" == "swap" || "$lv" =~ ^osd-block- ]]; then

But if custom thinpools exist these will be offered up for deletion by the script:
Example:
image

Fix is avoiding all thinpools, now does not allow the user to delete custom thinpool.
image

I´ve tested functionality after the fix,

lvs -o lv_name,vg_name,lv_size,data_percent,metadata_percent,lv_health_status                                                                                                                                                                                                                                                                                        46m
 lvcreate -V10M -T pve/data -n test-orphan

-> still lable to delete orphan lvm afterwards, and thin-pools are excluded.

Its questionable if actually deleting a thinpool would work if it still has volumes, mine would have open mounts and cmd would fail, but eventually users could be in a state where the cmd would actually succeed and introduce dl? I dont want to test deleting a thinpool.

/dev/nvme0n1p3 (Physical Partition)
└── pve (VG)
├── data (Thin Pool LV) <<<< protected before fix
│ ├── data_tdata (Thin Pool Data LV)
│ └── data_tmeta (Thin Pool Metadata LV)
├── vm-100-disk-0 (Thin LV inside 'data')

/dev/sda (Physical Disk)
└── 4TBSSD (VG)
├── thinpool (Thin Pool LV) <<<< not protected before fix, but after.
│ ├── thinpool_tdata (Thin Pool Data LV)
│ └── thinpool_tmeta (Thin Pool Metadata LV)
├── vm-100-disk-0 (Thin LV inside 'thinpool')

fix is using this logic:

lvs --noheadings -o lv_name,vg_name,lv_size,seg_type --separator ' ' 2>/dev/null | awk '{print $1, $2, $3, $4}'
thinpool 4TBSSD 3.60t thin-pool
                                     ^^^^^                                 
data pve <1.63t thin-pool
                           ^^^^^

🔗 Related PR / Issue

Link: #

✅ Prerequisites (X in brackets)

  • [x ] Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • [x ] No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.

@onethree7 onethree7 requested a review from a team as a code owner August 10, 2025 04:27
@github-actions github-actions bot added pve-tool update script A change that updates a script labels Aug 10, 2025
Copy link
Member

@MickLesk MickLesk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I could only implement what I use :D but thanks for the extension.

@tremor021 tremor021 merged commit 4258d44 into community-scripts:main Aug 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pve-tool update script A change that updates a script
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants