Have OS X wait for ZFS during boot

Developer discussions.

Re: Have OS X wait for ZFS during boot

Postby lundman » Wed Dec 23, 2015 2:10 pm

Code: Select all
zpool create BOOM raidz /var/tmp/test1.dsk /var/tmp/test2.dsk /var/tmp/test3.dsk


Assuming you want to call it BOOM, and you want raidz, with the three disks.

Code: Select all
zfs create -V 1G BOOM/mydisk


create virtual disk "mydisk" in pool, then use DiskUtility to partition disk (guid 1 part) and format as HFS+.
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: Have OS X wait for ZFS during boot

Postby bhagaban » Fri Jan 22, 2016 3:15 am

Hi,

I have created a file with below command.

mkfile -n 1g test1.dsk

how i will convert it into a virtual device. and how i will mount a file system on it.

Regards,

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

Re: Have OS X wait for ZFS during boot

Postby ilovezfs » Fri Jan 22, 2016 3:21 am

file pool:
zpool create mytest1 `pwd`/test1.dsk

fake device pool:
hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount test2.dsk
outputs /dev/diskM

zpool create mytest2 diskM

or

If file extension is .img
hdid -nomount test3.img
output /dev/diskN

zpool create mytest3 diskN
ilovezfs
 
Posts: 232
Joined: Thu Mar 06, 2014 7:58 am

Re: Have OS X wait for ZFS during boot

Postby bhagaban » Wed Jan 27, 2016 2:26 am

Hi

zpool create BOOM raidz /var/tmp/test1.dsk /var/tmp/test2.dsk /var/tmp/test3.dsk

when I typed this command. I saw zfs file system is mounting. and I want only zvol and no file system.

Regards,

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

Re: Have OS X wait for ZFS during boot

Postby ilovezfs » Wed Jan 27, 2016 3:55 am

zpool create -O canmount=off ...

or

zpool create -O mountpoint=none ...

Then

zfs create -V [size] poolname/volname
ilovezfs
 
Posts: 232
Joined: Thu Mar 06, 2014 7:58 am

Re: Have OS X wait for ZFS during boot

Postby bhagaban » Thu Jan 28, 2016 8:09 am

Hi,

Actually I am able to mount a test.dsk file with creating a block device with help of zpool command and zfs create command. But when i am doing unmounting the same vol , and again mounting I am not able to see the old data, It' again formatting, how will I see the previously mounted data.
bhagaban
 
Posts: 22
Joined: Mon Nov 30, 2015 6:31 am

Re: Have OS X wait for ZFS during boot

Postby ilovezfs » Thu Jan 28, 2016 4:14 pm

Code: Select all
bash-4.3# mkfile 512m disk.bin
bash-4.3# zpool create -O canmount=off thepool `pwd`/disk.bin
bash-4.3# zfs create -V 256M thepool/thevol
bash-4.3# readlink /var/run/zfs/zvol/dsk/thepool/thevol
/dev/disk2
bash-4.3# diskutil partitionDisk disk2 1 GPTFormat hfs+ thehfs 100%
Started partitioning on disk2
Unmounting disk
Creating the partition map
Waiting for the disks to reappear
Formatting disk2s1 as Mac OS Extended with name thehfs
Initialized /dev/rdisk2s1 as a 256 MB HFS Plus volume
Mounting disk
Finished partitioning on disk2
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *268.4 MB   disk2
   1:                  Apple_HFS thehfs                  268.4 MB   disk2s1
bash-4.3# dd if=/dev/urandom of=/Volumes/thehfs/ur.bin bs=512 count=20480
20480+0 records in
20480+0 records out
10485760 bytes transferred in 0.729922 secs (14365589 bytes/sec)
bash-4.3# ls -lh /Volumes/thehfs/ur.bin
-rw-r--r--  1 _unknown  _unknown    10M Jan 28 16:12 /Volumes/thehfs/ur.bin
bash-4.3# openssl dgst -sha512 /Volumes/thehfs/ur.bin
SHA512(/Volumes/thehfs/ur.bin)= 5b4782cc6a4855153770b3338f9f07d439e81548a3fb47bcdee263c2e11463eb2867384aabc043da09bf6c3beb87b0102a0ef702a7b94e9fd718006876798940
bash-4.3# zpool export thepool
Attempting to eject volume 'thepool/thevol'
Running process: '/usr/sbin/diskutil' 'unmountDisk' '/dev/disk2'
Unmount of all volumes on disk2 was successful
bash-4.3# openssl dgst -sha512 /Volumes/thehfs/ur.bin
/Volumes/thehfs/ur.bin: No such file or directory
bash-4.3# zpool import -d . thepool
bash-4.3# openssl dgst -sha512 /Volumes/thehfs/ur.bin
SHA512(/Volumes/thehfs/ur.bin)= 5b4782cc6a4855153770b3338f9f07d439e81548a3fb47bcdee263c2e11463eb2867384aabc043da09bf6c3beb87b0102a0ef702a7b94e9fd718006876798940
ilovezfs
 
Posts: 232
Joined: Thu Mar 06, 2014 7:58 am

Re: Have OS X wait for ZFS during boot

Postby bhagaban » Thu Jan 28, 2016 10:06 pm

Hi ,

I am unable to retrieve my old data on zvol which i have created.

mohanty:zfs-master_fuulworking bmohant1$ sudo ./zpool.sh export TESTT
Unable to automatically unmount ZVOL, is 'zed' running?
Use 'diskutil unmountdisk /dev/diskX' to complete export.
cannot export 'TESTT': pool is busy
mohanty:zfs-master_fuulworking bmohant1$ sudo ./zpool.sh export BOOM
cannot open 'BOOM': no such pool
mohanty:zfs-master_fuulworking bmohant1$ sudo ./zpool.sh export TESTT
Unable to automatically unmount ZVOL, is 'zed' running?
Use 'diskutil unmountdisk /dev/diskX' to complete export.
cannot export 'TESTT': pool is busy
mohanty:zfs-master_fuulworking bmohant1$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *251.0 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_CoreStorage 250.1 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS Macintosh HD *249.8 GB disk1
Logical Volume on disk0s2
3111CB20-0514-48F8-A8BC-6A44E5FAA549
Unlocked Encrypted
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *7.8 GB disk2
1: Windows_NTFS FAT 7.8 GB disk2s1
/dev/disk3
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *1.1 GB disk3
1: DOS_FAT_32 ENCRYPT 1.1 GB disk3s1
mohanty:zfs-master_fuulworking bmohant1$ diskutil unmountdisk /dev/disk3
Unmount of all volumes on disk3 was successful
mohanty:zfs-master_fuulworking bmohant1$
mohanty:zfs-master_fuulworking bmohant1$ sudo ./zpool.sh status
pool: TESTT
state: ONLINE
scan: none requested
config:

NAME STATE READ WRITE CKSUM
TESTT ONLINE 0 0 0
/Volumes/FAT/McAfee EERM/encrypted.dsk ONLINE 0 0 0

errors: No known data errors
mohanty:zfs-master_fuulworking bmohant1$
mohanty:zfs-master_fuulworking bmohant1$ sudo ./zpool.sh import TESTT
cannot import 'TESTT': a pool with that name already exists
use the form 'zpool import <pool | id> <newpool>' to give it a new name
mohanty:zfs-master_fuulworking bmohant1$ sudo ./zpool.sh import . TESTT
cannot import '.': no such pool available
mohanty:zfs-master_fuulworking bmohant1$ sudo ./zpool.sh import -d . TESTT
cannot import 'TESTT': a pool with that name already exists
use the form 'zpool import <pool | id> <newpool>' to give it a new name
mohanty:zfs-master_fuulworking bmohant1$
bhagaban
 
Posts: 22
Joined: Mon Nov 30, 2015 6:31 am

Re: Have OS X wait for ZFS during boot

Postby ilovezfs » Fri Jan 29, 2016 11:07 am

Your vdev is /Volumes/FAT/McAfee EERM/encrypted.dsk

So -d takes "/Volumes/FAT/McAfee EERM" not "." unless you happen to already have cd'd to "/Volumes/FAT/McAfee EERM"
Code: Select all
sudo zpool import -d "/Volumes/FAT/McAfee EERM" TESTT
or
Code: Select all
cd "/Volumes/FAT/McAfee EERM"
sudo zpool import -d . TESTT
ilovezfs
 
Posts: 232
Joined: Thu Mar 06, 2014 7:58 am

Re: Have OS X wait for ZFS during boot

Postby bhagaban » Sun Jan 31, 2016 11:12 pm

Hi,

I have already a test.dsk file is there. And it is already initialised/formatted with FAT32 file system, but not yet mounted.

And I have created a zvol with create command using the previously formatted test.dsk as a file with below comand.

zpool create -O canmount=off thepool `pwd`/test.dsk

zfs create -V 256M thepool/thevol

But as soon as the thevol volume is created it as again asking for initialising for a file system. And it is unable to take the previously initialised file system. 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.

Regards,

Bhagaban
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 15 guests

cron