Hey Gang,
For those of you at the meeting who don't remember, Kevin had a 32GB flash disk that had a controller that had a built in understanding of FAT32. Thus formatting it as any other file system would work until you actually wrote to it then it would go insane.
I postulated that one way to solve this would be to use LVM or MD, however when we tried this I hit a road block in that pvcreate won't let you pvcreate a regular old file, you need a device file, the same thing with MD.
I finally managed to get it to work without having to hand add any devices into /dev... here's how...
For my testing I created 4 100MB files using the command: dd if=/dev/zero of=part[1-4] bs=1024k count=100
This is what Kevin would need to do to on his flash drive...
1. Create 16, 2GB files on the flash drive named part[1-16]
2. Create loopback to file mappings using the command "losetup /dev/loop1 part1", repeat for all devices Also note, with this you could setup loopback encryption on these devices...
If you suddenly find yourself without a loopback device issue the command in /dev "./MAKEDEV loop" However, I think udev will probably take care of it behind the scenes.
3. pvcreate /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4 ...
4. vgcreate vgHACK /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4 ...
At this point if you issue a "vgdisplay" you should see how many (PE) physical extents you have.
5. lvcreate -n volume_name -l num_of_extends vgHACK
If you use -L you can specify 300M, etc. Also you can specify how many stripes you want the data to be written in, which is handy if your 16 devices were on seperate disk controllers...
Also you don't have to use all the extends in one logical volume, you could create lots of little volumes.
6. mkfs.ext3 /dev/vgHACK/volume_name
7. mount filesystem, sit back in bemusement that linux gives you the flexibility to do such things.
Now... while were at it, if instead of LVM, if you wanted to use MD, this is what you'd do.
If you have the lvm stuff from above, unmount the filesystem and issue a vgremove vgHACK it'll warn about active volumes, blah, blah...
This command will take loop1,loop2,loop3,loop4 and put them into a 4 member RAID0 with no spare.
mdadm -C /dev/md0 -l 0 -n 4 /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4
This command will create a raid5 out of the four devices without a spare.
mdadm -C /dev/md0 -l 0 -n 4 /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4
It'll go off and build the array, now just format and mount and you're set to go. cat /proc/mdstat to see what it's upto.
I was thinking of other insane things that Kevin can do with his 3 32GB flash disks.
He could create 3 logical volumes each containing 16 members and then create an raid5 MD device using the logical volume members...
He could create 3 16 member raid0's and then create a raid 5 out of them.
He could install ZFS on top of fuse and then put all 48 devices into a zpool...
I'll stop here, but I'm sure others have some even demented/funny ideas...
Enjoy!
Tim.
--
I am weary of the allegiances of any politician who refers to their constituents as "consumers".