The `lofiadm'' man page describes how to export a file as a block device and then use `mkfs -F pcfs'' to create a FAT filesystem on it. Can''t I do the same thing by first creating a zvol and then creating a FAT filesystem on it? Nothing I''ve tried seems to work. Isn''t the zvol just another block device? -- -Gary Mills- -Unix Group- -Computer and Network Services-
Fajar A. Nugraha
2011-Jul-10 16:16 UTC
[zfs-discuss] How create a FAT filesystem on a zvol?
On Sun, Jul 10, 2011 at 10:10 PM, Gary Mills <mills at cc.umanitoba.ca> wrote:> The `lofiadm'' man page describes how to export a file as a block > device and then use `mkfs -F pcfs'' to create a FAT filesystem on it. > > Can''t I do the same thing by first creating a zvol and then creating > a FAT filesystem on it?seems not.> ?Nothing I''ve tried seems to work. ?Isn''t the > zvol just another block device?That''s the problem: zvol is just another block device. Some solaris tools (like fdisk, or "mkfs -F pcfs") needs disk geometry to function properly. zvols doesn''t provide that. If you want to use zvols to work with such tools, the easiest way would be using lofi, or exporting zvols as iscsi share and import it again. For example, if you have a 10MB zvol and use lofi, fdisk would show these geometry Total disk size is 34 cylinders Cylinder size is 602 (512 byte) blocks ... which will then be used if you run "mkfs -F pcfs -o nofdisk,size=20480". Without lofi, the same command would fail with Drive geometry lookup (need tracks/cylinder and/or sectors/track: Operation not supported -- Fajar
On Sun, Jul 10, 2011 at 11:16:02PM +0700, Fajar A. Nugraha wrote:> On Sun, Jul 10, 2011 at 10:10 PM, Gary Mills <mills at cc.umanitoba.ca> wrote: > > The `lofiadm'' man page describes how to export a file as a block > > device and then use `mkfs -F pcfs'' to create a FAT filesystem on it. > > > > Can''t I do the same thing by first creating a zvol and then creating > > a FAT filesystem on it? > > seems not.[...]> Some solaris tools (like fdisk, or "mkfs -F pcfs") needs disk geometry > to function properly. zvols doesn''t provide that. If you want to use > zvols to work with such tools, the easiest way would be using lofi, or > exporting zvols as iscsi share and import it again. > > For example, if you have a 10MB zvol and use lofi, fdisk would show > these geometry > > Total disk size is 34 cylinders > Cylinder size is 602 (512 byte) blocks > > ... which will then be used if you run "mkfs -F pcfs -o > nofdisk,size=20480". Without lofi, the same command would fail with > > Drive geometry lookup (need tracks/cylinder and/or sectors/track: > Operation not supportedSo, why can I do it with UFS? # zfs create -V 10m rpool/vol1 # newfs /dev/zvol/rdsk/rpool/vol1 newfs: construct a new file system /dev/zvol/rdsk/rpool/vol1: (y/n)? y Warning: 4130 sector(s) in last cylinder unallocated /dev/zvol/rdsk/rpool/vol1: 20446 sectors in 4 cylinders of 48 tracks, 128 sectors 10.0MB in 1 cyl groups (14 c/g, 42.00MB/g, 20160 i/g) super-block backups (for fsck -F ufs -o b=#) at: 32, Why is this different from PCFS? -- -Gary Mills- -Unix Group- -Computer and Network Services-
Gary Mills wrote:> On Sun, Jul 10, 2011 at 11:16:02PM +0700, Fajar A. Nugraha wrote: > >> On Sun, Jul 10, 2011 at 10:10 PM, Gary Mills <mills at cc.umanitoba.ca> wrote: >> >>> The `lofiadm'' man page describes how to export a file as a block >>> device and then use `mkfs -F pcfs'' to create a FAT filesystem on it. >>> >>> Can''t I do the same thing by first creating a zvol and then creating >>> a FAT filesystem on it? >>> >> seems not. >> > [...] > >> Some solaris tools (like fdisk, or "mkfs -F pcfs") needs disk geometry >> to function properly. zvols doesn''t provide that. If you want to use >> zvols to work with such tools, the easiest way would be using lofi, or >> exporting zvols as iscsi share and import it again. >> >> For example, if you have a 10MB zvol and use lofi, fdisk would show >> these geometry >> >> Total disk size is 34 cylinders >> Cylinder size is 602 (512 byte) blocks >> >> ... which will then be used if you run "mkfs -F pcfs -o >> nofdisk,size=20480". Without lofi, the same command would fail with >> >> Drive geometry lookup (need tracks/cylinder and/or sectors/track: >> Operation not supported >> > > So, why can I do it with UFS? > > # zfs create -V 10m rpool/vol1 > # newfs /dev/zvol/rdsk/rpool/vol1 > newfs: construct a new file system /dev/zvol/rdsk/rpool/vol1: (y/n)? y > Warning: 4130 sector(s) in last cylinder unallocated > /dev/zvol/rdsk/rpool/vol1: 20446 sectors in 4 cylinders of 48 tracks, 128 sectors > 10.0MB in 1 cyl groups (14 c/g, 42.00MB/g, 20160 i/g) > super-block backups (for fsck -F ufs -o b=#) at: > 32, > > Why is this different from PCFS? >UFS has known for years that drive geometries are bogus, and just fakes something up to keep itself happy. What UFS thinks of as a cylinder bares no relation to actual disk cylinders. If you give mkfs_pcfs all the geom data it needs, then it won''t try asking the device... andrew at opensolaris:~# zfs create -V 10m rpool/vol1 andrew at opensolaris:~# mkfs -F pcfs -o fat=16,nofdisk,nsect=255,ntrack=63,size=20000 /dev/zvol/rdsk/rpool/vol1 Construct a new FAT file system on /dev/zvol/rdsk/rpool/vol1: (y/n)? y andrew at opensolaris:~# fstyp /dev/zvol/rdsk/rpool/vol1 pcfs andrew at opensolaris:~# fsck -F pcfs /dev/zvol/rdsk/rpool/vol1 ** /dev/zvol/rdsk/rpool/vol1 ** Scanning file system meta-data ** Correcting any meta-data discrepancies 10143232 bytes. 0 bytes in bad sectors. 0 bytes in 0 directories. 0 bytes in 0 files. 10143232 bytes free. 512 bytes per allocation unit. 19811 total allocation units. 19811 available allocation units. andrew at opensolaris:~# mount -F pcfs /dev/zvol/dsk/rpool/vol1 /mnt andrew at opensolaris:~# -- Andrew Gabriel