Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the ability to partition used disks #31

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Omarabdul3ziz
Copy link

@Omarabdul3ziz Omarabdul3ziz commented Dec 4, 2024

Description

Tested on

  • full non-partitioned disk
  • disk with a single partition and empty space
  • disk with the whole space divided into multiple partitions
  • a partition/disk labeled with zospxe

@Omarabdul3ziz Omarabdul3ziz force-pushed the main_disk_partitioning branch from 682f8ca to 6be07e9 Compare December 8, 2024 10:34
@Omarabdul3ziz Omarabdul3ziz force-pushed the main_disk_partitioning branch from 9f95d12 to 7e8f815 Compare December 8, 2024 11:30
func isValidAsDevice(space DiskSpace) bool {
// empty space around and in-between partitions used for
// partitioning table metadata and partitions alignment
const minDeviceSizeBytes = 2 * 1024 * 1024 // 2 MB
Copy link
Member

Choose a reason for hiding this comment

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

I think a 2MB disk is not really usable in practice. I suggest this is in creased to 2GB or even 5GB

What do you think @xmonader ?

Copy link
Member

@muhamadazmy muhamadazmy left a comment

Choose a reason for hiding this comment

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

Thank you so much @Omarabdul3ziz for creating this PR. I left a minor comment :)

Copy link

@delandtj delandtj left a comment

Choose a reason for hiding this comment

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

@Omarabdul3ziz , @muhamadazmy please check


func (d *DeviceInfo) AllocateEmptySpace(ctx context.Context, space DiskSpace) error {
args := []string{
d.Path, "mkpart", "primary", space.Start, space.End,
Copy link

Choose a reason for hiding this comment

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

this command is only valid for DOS Disklabels (DOS Partition table)
for GPT disklabels it's mkpart $somename $fstype space.start space.end

Copy link

Choose a reason for hiding this comment

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

also, the script creates a partition for BTRFS with Label ZOSCACHE you can mount that directly

Copy link

Choose a reason for hiding this comment

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

https://github.com/diskfs/go-diskfs
instead of shelling into parted commands, this would be a lot more manageable

Copy link
Author

Choose a reason for hiding this comment

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

the code already handle the zos-cache named devices, this part for preparing all possible spaces zos can use for cache if no zos-cache partition is found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants