LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   creating a virtual whole-disk from real partitions (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/creating-a-virtual-whole-disk-from-real-partitions-4175537594/)

Skaperen 03-23-2015 06:51 AM

creating a virtual whole-disk from real partitions
 
a feature i would like to see is a way to specify "a disk" as a series of file and/or block device sources, creating a virtual partition table with the various sources, in their whole, becoming virtual partitions of this created whole disk, with sizes determined either from the size of the source or specified in the list, plus support for partitioned sources (specify which partition(s) is/are sources). a simple usage would allow 2 files to become a 2 partition whole disk ... a more complex usage could make a 5 partition BSD disk appear as a 5 partition GUID disk (need support for BSD, DOS, and GUID parsing and creation for thorough usage).

Your thoughts on such a feature?

T3RM1NVT0R 03-23-2015 02:13 PM

If I am getting it correctly you are talking about slicing a single disk and then using the partition to act as a whole virtual disk. Which means if I have 100 gig HDD and I create 5 partitions of 20 GB each then each one of them will act as 20 gig hdd which will have its own partition table and I can further partition it. Is that correct?

If the above is correct then I would say it is pretty good and I can somewhat correlate it with what Openfiler does. Though it is based on iscsi and virtual SAN concept but the idea remains the same.

jefro 03-23-2015 03:34 PM

Can you explain why you'd want to do this maybe. Not sure I get it.

I think you can already in many VM's. "specify "a disk" as a series of file and/or block device sources,"

The partition table has nothing to do with how the virtual disk is made.

So parts of your question is how to make up a virtual hard drive from more than one file or raw device.


All in all I don't see the need for this exactly. The current methods may be to use LVM, ZFS or Btrfs on a virtual hard drive. Virtual support for raw and partitions and disks exist now. We used to make virtual hard drives out of less than 2G files to bypass the filesystem limits. It is still there but now used that much now.

allend 03-23-2015 06:33 PM

I may be reading this wrong, but if you have a number of disk images, then mounting them under a single directory using losetup would appear to achieve what you are describing.

Doug G 03-23-2015 07:29 PM

Sounds like you could use LVM

Skaperen 03-24-2015 05:34 AM

Quote:

Originally Posted by jefro (Post 5336587)
Can you explain why you'd want to do this maybe. Not sure I get it.

i often build partition images the i want to merge together but i don't want to copy so many GBs (time and space) to make a whole drive to run a test (in a VM) with code that expects it to be partitioned.

as a plus it could make cloud configurations easier.

Quote:

Originally Posted by jefro (Post 5336587)
I think you can already in many VM's. "specify "a disk" as a series of file and/or block device sources,"

if they all had this it would be great. it has been a while since i used a VM ... maybe it has been added.


Quote:

Originally Posted by jefro (Post 5336587)
The partition table has nothing to do with how the virtual disk is made.

yeah ... that's the issue


Quote:

Originally Posted by jefro (Post 5336587)
So parts of your question is how to make up a virtual hard drive from more than one file or raw device.

the whole idea


Quote:

Originally Posted by jefro (Post 5336587)
All in all I don't see the need for this exactly. The current methods may be to use LVM, ZFS or Btrfs on a virtual hard drive. Virtual support for raw and partitions and disks exist now. We used to make virtual hard drives out of less than 2G files to bypass the filesystem limits. It is still there but now used that much now.

i don't see what you think these tools can do

example:

i have a file that is to be partition 1 (already ext2)

a big (nearly 2TB) partition on a USB drive is to be partition 2 (ext4)

a ramdisk is to be partition 3 (initialized as swap)

how would LVM, ZFS or Btrfs be used here?

Skaperen 03-24-2015 05:36 AM

Quote:

Originally Posted by allend (Post 5336680)
I may be reading this wrong, but if you have a number of disk images, then mounting them under a single directory using losetup would appear to achieve what you are describing.

how?

maybe you are reading me wrong.

Skaperen 03-24-2015 05:40 AM

Quote:

Originally Posted by T3RM1NVT0R (Post 5336528)
If I am getting it correctly you are talking about slicing a single disk and then using the partition to act as a whole virtual disk. Which means if I have 100 gig HDD and I create 5 partitions of 20 GB each then each one of them will act as 20 gig hdd which will have its own partition table and I can further partition it. Is that correct?

it could be used to do that ... among many other things.

Quote:

Originally Posted by T3RM1NVT0R (Post 5336528)
If the above is correct then I would say it is pretty good and I can somewhat correlate it with what Openfiler does. Though it is based on iscsi and virtual SAN concept but the idea remains the same.

it looks like Openfiler is an OS. are you comparing to it?

rknichols 03-24-2015 09:48 AM

Quote:

Originally Posted by Skaperen (Post 5336857)
i often build partition images the i want to merge together but i don't want to copy so many GBs (time and space) to make a whole drive to run a test (in a VM) with code that expects it to be partitioned.

I just use a huge sparse file for that, as long as I don't plan on actually filling it with that much data, of course.
Code:

$ truncate --size 2T /var/tmp/stuff
$ ll -s /var/tmp/stuff
0 -rw-rw-r--. 1 zrbj zrbj 2199023255552 2015-03-24 09:39:34 /var/tmp/stuff

Give that to a VM as a raw image, partition it, make some filesystems, store a few test files, and it's only using a few hundred megabytes of actual space in /var/tmp.

T3RM1NVT0R 03-24-2015 03:47 PM

@Skaperen
 
Quote:

it looks like Openfiler is an OS. are you comparing to it?
Nope I am not comparing it to the OS but to the concept of making a box act as virtual SAN. May be I got your question wrong I was keeping in mind the example I explained in my previous post and the next para / line was based on that.

Skaperen 03-26-2015 07:17 AM

Quote:

Originally Posted by T3RM1NVT0R (Post 5337150)
Nope I am not comparing it to the OS but to the concept of making a box act as virtual SAN. May be I got your question wrong I was keeping in mind the example I explained in my previous post and the next para / line was based on that.

i guess Openfiler could do what i want but i want to do this in Linux where the parts i want to merge can be files or block devices or their partitions. i could use losetup to make a file look like a block device if the file i a raw image but it might be in a special image format.

Skaperen 03-26-2015 07:18 AM

Quote:

Originally Posted by rknichols (Post 5336990)
I just use a huge sparse file for that, as long as I don't plan on actually filling it with that much data, of course.
Code:

$ truncate --size 2T /var/tmp/stuff
$ ll -s /var/tmp/stuff
0 -rw-rw-r--. 1 zrbj zrbj 2199023255552 2015-03-24 09:39:34 /var/tmp/stuff

Give that to a VM as a raw image, partition it, make some filesystems, store a few test files, and it's only using a few hundred megabytes of actual space in /var/tmp.

i might be filling it with HUGE information over 1TB.


All times are GMT -5. The time now is 11:34 PM.