Removing drive from Raid1

Rockstor won’t let me remove a drive from a 3 drive Raid1 pool. Is it safe to run btrfs device delete, or will that confuse Rockstor?

We’ve just added support for this in 3.5-9(released like 2 minutes ago).

Give it a try and provide your feedback!

Thanks.

I only had 58% free space so had to edit storageadmin/views/pool.py to let it allow me to remove the drive.

While trying to remove the drive I’ve hit https://bugzilla.kernel.org/show_bug.cgi?id=68411 which I solved by truncating and deleting the offending files

I then tried removing the drive again and Rockstor hung for a while then produced an error (sorry I didn’t copy it down) and the drive was still in the pool. The balance tab didn’t show any balance running, but the system was actually in the process of removing the drive. Once that completed, Rockstor still thought the drive was part of the pool. Trying to remove the drive through Rockstor again finally worked.

I also hit a bug again with switching device names. This time the error was
ERROR [storageadmin.util:39] exception: duplicate key value violates unique constraint "storageadmin_disk_name_key"
DETAIL:  Key (name)=(sdd) already exists.

Thanks for a rockstar troubleshooting job. It’s very helpful as we improve Rockstor. Currently, resize operation is done synchronously and sometimes it takes a long time for btrfs to remove the drive. But rockstor gives up after certain number of seconds. So, I’ve made the resize operation idempotent to help with this. When you ran the resize/remove again, rockstor knows that the disk has already been removed, so it just updates some state information and everything is happy. We’ll eventually improve this the proper way. Here’s the issue for it: https://github.com/rockstor/rockstor-core/issues/580

For the duplicate key value error, can you send the logs to support@rockstor.com? Or you can copy/paste the relevant traceback from /opt/rockstor/var/log/rockstor.log file. Here’s the issue: https://github.com/rockstor/rockstor-core/issues/581

[20/Jan/2015 22:53:17] ERROR [storageadmin.util:38] request path: /api/disks method: GET data: <QueryDict: {}>
[20/Jan/2015 22:53:17] ERROR [storageadmin.util:39] exception: duplicate key value violates unique constraint "storageadmin_disk_name_key"
DETAIL:  Key (name)=(sdd) already exists.
Traceback (most recent call last):
  File “/opt/rockstor/src/rockstor/rest_framework_custom/generic_view.py”, line 89, in _handle_exception
    yield
  File “/opt/rockstor/src/rockstor/storageadmin/views/disk.py”, line 49, in get_queryset
    self._scan()
  File “/opt/rockstor/eggs/Django-1.6.2-py2.7.egg/django/db/transaction.py”, line 399, in inner
    return func(*args, **kwargs)
  File “/opt/rockstor/src/rockstor/storageadmin/views/disk.py”, line 85, in _scan
    dob.save()
  File “/opt/rockstor/eggs/Django-1.6.2-py2.7.egg/django/db/models/base.py”, line 545, in save
    force_update=force_update, update_fields=update_fields)
  File “/opt/rockstor/eggs/Django-1.6.2-py2.7.egg/django/db/models/base.py”, line 573, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File “/opt/rockstor/eggs/Django-1.6.2-py2.7.egg/django/db/models/base.py”, line 635, in _save_table
    forced_update)
  File “/opt/rockstor/eggs/Django-1.6.2-py2.7.egg/django/db/models/base.py”, line 679, in _do_update
    return filtered._update(values) > 0
  File “/opt/rockstor/eggs/Django-1.6.2-py2.7.egg/django/db/models/query.py”, line 507, in _update
    return query.get_compiler(self.db).execute_sql(None)
  File “/opt/rockstor/eggs/Django-1.6.2-py2.7.egg/django/db/models/sql/compiler.py”, line 976, in execute_sql
    cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
  File “/opt/rockstor/eggs/Django-1.6.2-py2.7.egg/django/db/models/sql/compiler.py”, line 782, in execute_sql
    cursor.execute(sql, params)
  File “/opt/rockstor/eggs/Django-1.6.2-py2.7.egg/django/db/backends/util.py”, line 53, in execute
    return self.cursor.execute(sql, params)
  File “/opt/rockstor/eggs/Django-1.6.2-py2.7.egg/django/db/utils.py”, line 99, in exit
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File “/opt/rockstor/eggs/Django-1.6.2-py2.7.egg/django/db/backends/util.py”, line 53, in execute
    return self.cursor.execute(sql, params)
IntegrityError: duplicate key value violates unique constraint "storageadmin_disk_name_key"
DETAIL:  Key (name)=(sdd) already exists.

Thank you, just what we need!

One more bug I found is that it won’t let you remove the first drive in the array. No error message; it just doesn’t get removed. Deleting the drive through the command line and rebooting let me remove it in Rockstor.

Thats interesting. Thanks sprint. I’ll test it out.