Have OS X wait for ZFS during boot

Developer discussions.

Re: Have OS X wait for ZFS during boot

Postby ilovezfs » Sun Jan 31, 2016 11:15 pm

"How can I give a previously formatted file or disk to the zvol create command so that after creating the virtual device it will not ask again for initialisation."

You would create a zvol of the correct size, and then use dd to clone the existing disk to the new zvol.
ilovezfs
 
Posts: 229
Joined: Thu Mar 06, 2014 7:58 am

Re: Have OS X wait for ZFS during boot

Postby bhagaban » Mon Feb 01, 2016 12:34 am

Hi,

In syntactically how i will do that.

Regards,

Bhagaban
bhagaban
 
Posts: 22
Joined: Mon Nov 30, 2015 6:31 am

Re: Have OS X wait for ZFS during boot

Postby ilovezfs » Mon Feb 01, 2016 4:46 am

Are you running zpool create more than once?
ilovezfs
 
Posts: 229
Joined: Thu Mar 06, 2014 7:58 am

Re: Have OS X wait for ZFS during boot

Postby bhagaban » Wed Feb 03, 2016 12:43 am

Hi ,

I have a test.dsk in my USB Pen drive which is already formatted with FAT32 file system.

/Volumes/FAT/test.dsk of size 2 gb.

I have created a pool with below command.

mohanty:zfs-master_fuulworking bmohant1$ sudo ./zpool.sh create -O mountpoint=none TESTT /Volumes/FAT/test.dsk

Then I have created a device the vol with below command
mohanty:zfs-master_fuulworking bmohant1$ sudo ./cmd/zfs/zfs create -V 1024M TESTT/vol


In this step it as asking again for initialisation, although it is previously formatted with with FAT32.

How I will the mount this test.dsk without initialising again.
bhagaban
 
Posts: 22
Joined: Mon Nov 30, 2015 6:31 am

Re: Have OS X wait for ZFS during boot

Postby ilovezfs » Wed Feb 03, 2016 1:52 am

You are confusing several things.

pen drive: physical device
pen drive device node: /dev/disk3 (let's say it's disk3)
pen drive bsd name: disk3
pen drive block device: /dev/disk3
pen drive partition table: gpt or mbr. You would have to tell me.
pen drive first partition: /dev/disk3s1
pen drive second partition: /dev/disk3s2
likely location of pen drive FAT32 file system: /dev/disk3s2
pen drive FAT32 file system mount point: /Volumes/FAT
file on pen drive: /Volumes/FAT/test.dsk
ZFS pool backing store: /Volumes/FAT/test.dsk
ZFS pool virtual device, "vdev" : /Volumes/FAT/test.dsk
test.dsk vdev type: file
Number of vdevs in the pool: 1
Number of datasets in the pool: 2
Pool name: TESTT
First dataset name: TESTT
Type of first dataset: file system
Mountpoint of first dataset: none
Second dataset name: TESTT/vol
Type of second dataset: ZFS volume or "zvol"
Mountpoint of TESTT/vol: not applicable (N/A). zvols do not have mountpoints.
Location of second dataset when pool is imported: /dev/disk4 (it will vary each time you import the pool. You must locate up the current name of the disk each time)
TESTT/vol block device: /dev/disk4
Initial partitioning status of TESTT/vol: Not partitioned, also referred to as "Not initialized"
Initial number of partitions on TESTT/vol: zero
Initial number of file systems on TESTT/vol: zero
What is TESTT/vol? zvol
Is TESTT/vol a file system? No.
Does TESTT/vol initially have a FAT32 file system on it? No.

You must partition TEST/vol in order to use it. You can do this with Disk Utility.app or the command line utility /usr/sbin/diskutil
Assuming TESTT/vol is currently assigned to disk4, you may partition it with this command:

diskutil partitionDisk disk4 1 GPTFormat fat32 myfirstzvol 100%

Should I run this command ever again? No.

Following this command,
Is TESTT/vol partitioned? Yes.
Does it have a partition table? Yes.
What type of partition table? GPT.
How many partitions? 1
Location of block device of first partition on TESTT/vol: /dev/disk4s1

Is disk4 a vdev in your pool? No.
Does disk4 have a file system on it now? Yes.
Can you see the file system? If TESTT is imported.
Where is TESTT/vol mounted? It's not.
What is mounted? disk4s1.
What is disk4s1? A partition on disk4.
What is disk4? The block device assigned to the zvol TESTT/vol.
Is the pool on disk4? No.
Is the pool on disk4s1? No.
Is disk4 a vdev of the pool TESTT? No.
Is /Volumes/FAT the mountpoint of the ZVOL? No.
Are /Volumes/FAT and /Volumes/myfirstzvol the same folder? No.
Is /Volumes/FAT the mountpoint of the pool? No.
Does the pool have a mountpoint? No. You set it to none.
Does the ZVOL have a mountpoint? No. ZVOLs are block devices, not file systems.
Where is the file system on the ZVOL? Its first partition.
What is the name of the first partition on the ZVOL? disk4s1.
What is on disk4s1? A fat32 file system.
How do I unmount disk4s1? diskutil unmount disk4s1 OR diskutil unmount /Volumes/myfirstzvol or diskutil unmountDisk disk4
How do I mount disk4s1? diskutil mount disk4s1
How do I eject disk4? diskutil eject disk4
How do I re-insert disk4 after I eject it? You cannot. You must export, and re-import the pool to get it back.
How do I export the pool? zpool export TESTT
How do I import the pool? zpool import -d /Volumes/FAT TESTT
Should I run zpool create again? No.
What happens if I run zpool create again? You destroy the pool.
When I import the pool, do I have to mount the file system on the zvol's first partition manually? No.
Why not? Disk arbitration will mount it automatically.
Where will it mount it? /Volumes/myfirstzvol
Will I see files that are on /Volumes/FAT in /Volumes/myfirstzvol? No.
What will I see in /Volumes/myfirstzvol? Nothing until you put something there.
ilovezfs
 
Posts: 229
Joined: Thu Mar 06, 2014 7:58 am

Re: Have OS X wait for ZFS during boot

Postby bhagaban » Wed Feb 03, 2016 10:29 pm

Hi,

Actually

My Pendrive is already mounted.
$mount
/dev/disk2s1 on /Volumes/FAT (exfat, local, nodev, nosuid, noowners)
and mount point is : /Voulme/FAT

But inside pendrive there is test.dsk image (of size 1.8GB) is present as a file in test directory as below

/Voulme/FAT/test/test.dsk

But this test.dsk is already FAT formatted, It has FAT32 partition header.

I have created a pool with below command.

mohanty:zfs-master_fuulworking bmohant1$ sudo ./zpool.sh create -O mountpoint=none TESTT /Volumes/FAT/test/test.dsk

Then I have created a device the vol with below command
mohanty:zfs-master_fuulworking bmohant1$ sudo ./cmd/zfs/zfs create -V 1024M TESTT/vol


In this step it as asking again for initialisation, although it is previously formatted with with FAT32.
bhagaban
 
Posts: 22
Joined: Mon Nov 30, 2015 6:31 am

Re: Have OS X wait for ZFS during boot

Postby bhagaban » Wed Feb 03, 2016 10:45 pm

Hi,

Actually

My Pendrive is already mounted.
$mount
/dev/disk2s1 on /Volumes/FAT (exfat, local, nodev, nosuid, noowners)
and mount point is : /Voulme/FAT

But inside pendrive there is test.dsk image (of size 1.8GB) is present as a file in test directory as below

/Voulme/FAT/test/test.dsk

But this test.dsk is already FAT formatted, It has FAT32 partition header.

I have created a pool with below command.

mohanty:zfs-master_fuulworking bmohant1$ sudo ./zpool.sh create -O mountpoint=none TESTT /Volumes/FAT/test/test.dsk

Then I have created a device the vol with below command
mohanty:zfs-master_fuulworking bmohant1$ sudo ./cmd/zfs/zfs create -V 1024M TESTT/vol


In this step it as asking again for initialisation, although it is previously formatted with with FAT32.

How I can avoid second time initialisation and and need to use the previously initialised FAT32 header.

Doubt-2
-----------

I there any way I can skip first some byte of the file and give rest of the size to zvol
ex.

suppose i have test.dsk in /Volumes/FAT/test/test.dsk

as I told it is already fprmatted with FAT32 so all the partition header starts from after first 512 bytes.

first 512 byte ! Rest of the test.dsk is formatted with FAT32
-----------------!-------------------------------------------------------
-----------------!-------------------------------------------------------

How can I skip the first 521 byte and give rest size to as ZVOL device so that it will not ask for initialisation again and it will pick the partition header after first 512 byte.
bhagaban
 
Posts: 22
Joined: Mon Nov 30, 2015 6:31 am

Re: Have OS X wait for ZFS during boot

Postby ilovezfs » Wed Feb 03, 2016 11:26 pm

You ran zpool create on the image file. Any FAT file system that was in the image file is destroyed.
ilovezfs
 
Posts: 229
Joined: Thu Mar 06, 2014 7:58 am

Re: Have OS X wait for ZFS during boot

Postby bhagaban » Thu Feb 04, 2016 12:42 am

Which is the source file
bhagaban
 
Posts: 22
Joined: Mon Nov 30, 2015 6:31 am

Re: Have OS X wait for ZFS during boot

Postby bhagaban » Thu Feb 04, 2016 12:44 am

Which is the source file in kext responsible for erasing and creating the device.. Is any thing need to change , so that it will not erase already existing image. And it will read the existing image.
bhagaban
 
Posts: 22
Joined: Mon Nov 30, 2015 6:31 am

PreviousNext

Return to OpenZFS on OS X Development

Who is online

Users browsing this forum: No registered users and 1 guest