Skip to content

Commit

Permalink
Merge pull request #2360 from phillxnet/2308_Increase_minimum_recogni…
Browse files Browse the repository at this point in the history
…sed_disk_size_to_5GB_and_define_at_run-time

Increase minimum disk size to 5 GiB and define at run-time #2308
  • Loading branch information
phillxnet committed Apr 7, 2022
2 parents 81a0d5f + 1681095 commit 83be5bf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
6 changes: 0 additions & 6 deletions conf/settings.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,6 @@ SUPPORT = {
'log_loc': '${buildout:depdir}/var/log',
}

"""
Minimum disk size allowed is 1GB. Anything less is not really usable. Reduce
this to 100MB if you really need to, but any less would just break things.
"""
MIN_DISK_SIZE = 1024 * 1024

"""
Maximum number of seconds to keep data collected by smart probes. The logic
behind this needs to evolve quite a bit.
Expand Down
6 changes: 0 additions & 6 deletions conf/test-settings.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,6 @@ SUPPORT = {
'log_loc': '${buildout:depdir}/var/log',
}

"""
Minimum disk size allowed is 1GB. Anything less is not really usable. Reduce
this to 100MB if you really need to, but any less would just break things.
"""
MIN_DISK_SIZE = 1024 * 1024

"""
Maximum number of seconds to keep data collected by smart probes. The logic
behind this needs to evolve quite a bit.
Expand Down
12 changes: 11 additions & 1 deletion src/rockstor/storageadmin/views/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@

logger = logging.getLogger(__name__)

# Minimum disk size. Smaller disks will be ignored. Recommended minimum = 16 GiB.
# Btrfs works in chunks (units) of 1 GiB for data, and 256 MiB for metadata.
# Using very small disks requires mixed data/metadata chunks of 256 MiB.
# If a device is less than 16 GiB, the mixed (--mixed) mode is recommended.
# https://btrfs.wiki.kernel.org/index.php/FAQ
# https://btrfs.wiki.kernel.org/index.php/Glossary
# Rockstor does not enforce --mixed for any drive size.
# 5 GiB = (5 * 1024 * 1024) = 5242880 KiB
MIN_DISK_SIZE = 5242880

# A list of scan_disks() assigned roles: ie those that can be identified from
# the output of lsblk with the following switches:
# -P -o NAME,MODEL,SERIAL,SIZE,TRAN,VENDOR,HCTL,TYPE,FSTYPE,LABEL,UUID
Expand Down Expand Up @@ -102,7 +112,7 @@ def _update_disk_state():
:return: serialized models of attached and missing disks via serial num
"""
# Acquire a list (namedtupil collection) of attached drives > min size
disks = scan_disks(settings.MIN_DISK_SIZE)
disks = scan_disks(MIN_DISK_SIZE)
# Acquire a list of uuid's for currently unlocked LUKS containers.
# Although we could tally these as we go by noting fstype crypt_LUKS
# and then loop through our db Disks again updating all matching
Expand Down

0 comments on commit 83be5bf

Please sign in to comment.