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

Error when first disk is a device #549

Closed
lars18th opened this issue Jan 9, 2024 · 9 comments · Fixed by #552
Closed

Error when first disk is a device #549

lars18th opened this issue Jan 9, 2024 · 9 comments · Fixed by #552

Comments

@lars18th
Copy link

lars18th commented Jan 9, 2024

Hi,

I'm using this docker-compose.yml:

version: "3"
services:
  dsm:
    container_name: dsm
    image: vdsm/virtual-dsm:latest
    environment:
      DEVICE: "/dev/sdc"
      DEVICE2: "/dev/sdd"
      DEVICE3: "/dev/sde"
    devices:
      - /dev/kvm
      - /dev/sdc
      - /dev/sdd
      - /dev/sde
    cap_add:
      - NET_ADMIN
    ports:
      - 5000:5000
    volumes:
      /var/dsm:/storage
    restart: on-failure
    stop_grace_period: 2m

But, then at initial install I get this message:

dsm  | ❯ ERROR: Not enough free space to create a disk of 16G in /storage, it has only 14 GB available...
dsm  | ❯ ERROR: Please specify a smaller DISK_SIZE or disable preallocation by setting ALLOCATE=N.
dsm exited with code 0

Because my "root" partition has only 14GB. What I need is to use the /dev/sdc as the disk for the FIRST disk.
Any idea to fix it?
Thank you.

@kroese
Copy link
Collaborator

kroese commented Jan 9, 2024

You can set:

    environment:
      ALLOCATE: "N"

To disable preallocation of the disk space which will solve the issue (because this flag is not applied to the devices, only to folders).

@lars18th
Copy link
Author

lars18th commented Jan 9, 2024

Hi @kroese ,

You can set:

    environment:
      ALLOCATE: "N"

I've do this already. I'm doing a lot of tests with different environment tweaks. However, the current container seems that requires that the first volume is a disk image. So, could you check it please? I want to use only devices. I can accept that "boot" and "system" are disk images, but for the rest I don't want to use RAW or QCOW2 files.

Thank you.

@kroese
Copy link
Collaborator

kroese commented Jan 9, 2024

The diskspace check where you got the message

Not enough free space to create a disk of 16G in /storage, it has only 14 GB available...

Is only executed when ALLOCATE=Y. So its not possible that you see that message if you set ALLOCATE=N.

Yes its true that the first disk must be an image and not a device, but if you set ALLOCATE=N then the image will use no space so it should not be a big problem that way. Otherwise I must modify a lot of code in disk.sh and thats not worth the effort.

@lars18th
Copy link
Author

lars18th commented Jan 9, 2024

Hi @kroese ,

Yes, I know that I can use ALLOCATE=N and DISK_FMT: "qcow2" plus DISK_SIZE: "6G" to get a "small" thin image. But this creates a "volume1" that I don't need at all.

I feel it's not necessary that the user is enforced to use images if he want to use devices. The problem is that the current disk.sh and install.sh scripts want to create this first image. After a simple review I don't see that starting the qemu without a data file will be a problem. The problem is that your script assume that this file is necessary. So, I suggest a simple -e NO_FIRST_DATA=1 to overcome it. What you think?

@kroese
Copy link
Collaborator

kroese commented Jan 9, 2024

Yes, I agreed with you that it is possible to modify the code so that it does not need the dummy image. But I dont want to make the current code more complicated (or take the risk to introduce any bugs) so thats why I said its not worth the effort for me to fix it just to save that 2 MB of space.

Also this whole DEVICE parameter is not really supported anyway, that is why I don't mention it in the README. It was only added to support Proxmox/Vmware images, but is not recommended for use with physical devices and was never really tested. It's also pretty dangerous to use it with physical disks, because vDSM will complete wipe the whole disk to format it to BTRFS. So I would not advice anyone to use it.

@lars18th
Copy link
Author

lars18th commented Jan 9, 2024

Hi @kroese ,

I really need to use the DEVICE parameter. In my home server I'm virtualizing the main docker host, and only running this virtual-dsm container inside it. Therefore, I suggest to continue maintaining it.

Regarding the problem of the first volume, the problem is not the size. The problem is that you'll have an empty (prone to errors) volumen inside the virtualDSM. Only because one script forces to create this file. Why not remove this artificial restriction?

@kroese
Copy link
Collaborator

kroese commented Jan 9, 2024

You can just remove this line (line 456)

addDisk "userdata" "$DISK1_FILE" "$DISK_EXT" "disk" "$DISK_SIZE" "3" "0xc" "$DISK_FMT" || exit $?

And you have what you need. This is an open-source project, so everybody can just modify it to fit their own purpose.

@lars18th
Copy link
Author

lars18th commented Jan 9, 2024

This is an open-source project, so everybody can just modify it to fit their own purpose.

Yes! But I'm using the official docker container. Why not add something like execute this line only if -e DISABLE_DISK1=Y is not set?

Please. 😉

@lars18th
Copy link
Author

Thank you @kroese for fixing both issues. 👍

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 a pull request may close this issue.

2 participants