Страница 1 из 1

ZFS на флэшке

Добавлено: 2008-11-05 22:47:22
iZEN
Хочу сделать флешку со следующей структурой разделов:
1. FAT32 - первичный раздел;
2. UFS2 - первичный раздел;
3. ZFS - всё остальное пространство (первичный раздел).

При разметке флэшки fdisk'ом он просит указать sysid третьего раздела. У FAT32 sysid=xB (11), у UFS2 sysid= xA5 (165). Какой sysid у ZFS? Неужели xEE (238)?

Re: ZFS на флэшке

Добавлено: 2008-11-05 23:38:46
iZEN
Разметка флэшки:

Код: Выделить всё

% fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=1949 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=1949 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 11 (0x0b),(DOS or Windows 95 with 32 bit FAT)
    start 63, size 2088387 (1019 Meg), flag 80 (active)
	beg: cyl 0/ head 1/ sector 1;
	end: cyl 129/ head 254/ sector 63
The data for partition 2 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 131570019, size 8388261 (4095 Meg), flag 0
	beg: cyl 1021/ head 218/ sector 1;
	end: cyl 519/ head 254/ sector 63
The data for partition 3 is:
sysid 238 (0xee),(EFI GPT)
    start 10477467, size 20833218 (10172 Meg), flag 0
	beg: cyl 652/ head 49/ sector 1;
	end: cyl 924/ head 254/ sector 63
The data for partition 4 is:
<UNUSED>
Слайс с FAT32 отформатировал:

Код: Выделить всё

% newfs_msdos -L DOS7 /dev/da0s1 
/dev/da0s1: 2084280 sectors in 260535 FAT32 clusters (4096 bytes/cluster)
bps=512 spc=8 res=32 nft=2 mid=0xf0 spt=63 hds=255 hid=0 bsec=2088387 bspf=2036 rdcl=2 infs=1 bkbs=2
Не получается разметить второй слайс с UFS2 с помощью bsdlabel:

Код: Выделить всё

% bsdlabel -w -B da0s2
bsdlabel: /dev/da0s2 read: Input/output error

% bsdlabel -e da0s2
bsdlabel: /dev/da0s2 read: Input/output error
:unknown:

Re: ZFS на флэшке

Добавлено: 2008-11-06 0:34:25
Alex Keda
а зачем этот изврат?

Re: ZFS на флэшке

Добавлено: 2008-11-06 0:36:08
Гость
- может стоит перейти с fdisk(8) на gpart(8) для разметки диска?
- иметь корректный sysid совсем не обязательно.

Re: ZFS на флэшке

Добавлено: 2008-11-06 0:39:48
f_andrey
# bsdlabel -w da0s1 auto
# bsdlabel -B da0s1
# newfs /dev/da0s1a
а нафига ZFS на флешке? и если уж нужно почему не разметить средствами самой ZFS все эти идентификаторы вешь условная и поменять никогда не поздно.

Re: ZFS на флэшке

Добавлено: 2008-11-06 2:26:53
iZEN
f_andrey писал(а):
# bsdlabel -w da0s1 auto
# bsdlabel -B da0s1
# newfs /dev/da0s1a
Так разметится первый раздел (в терминах BIOS; в терминах FreeBSD — слайс) на флэшке в UFS2. А мне надо первым чтобы был с FAT32. Второй раздел (слайс) с UFS2. Третий раздел (слайс) с ZFS (но это потом).
f_andrey писал(а): а нафига ZFS на флешке?
Значит надо.
f_andrey писал(а):и если уж нужно почему не разметить средствами самой ZFS
Средствами ZFS разве можно разметить разделы с FAT32 и UFS2? :roll:
f_andrey писал(а):все эти идентификаторы вешь условная и поменять никогда не поздно.
Я это знаю.

Re: ZFS на флэшке

Добавлено: 2008-11-06 2:29:40
iZEN
Windows видит флэшку как большую дискету и требует отформатировать перед использованием, хотя на флешке уже есть ~1ГБ раздел с FAT32 (его не видит). Странно... :(

Re: ZFS на флэшке

Добавлено: 2008-11-06 9:54:53
zingel
ZFS на флешке....а скажи, действительно, нафига оно?

Re: ZFS на флэшке

Добавлено: 2008-11-06 13:51:16
iZEN
zingel писал(а):ZFS на флешке....а скажи, действительно, нафига оно?
В качестве рабочей ФС.

Re: ZFS на флэшке

Добавлено: 2008-11-06 15:40:03
iZEN
Вот для примера разбивка MemoryStick M2 2Gb под FreeBSD с последующим форматированием разделов FAT и UFS2:

Код: Выделить всё

% dmesg
...
umass0: <Sony MSAC-UAM1, class 0/0, rev 2.00/56.91, addr 2> on uhub1
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <Sony MSAC-UAM1 1.00> Removable Direct Access SCSI-0 device 
da0: 40.000MB/s transfers
da0: 1951MB (3995648 512 byte sectors: 255H 63S/T 248C)
% fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=248 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=248 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 6 (0x06),(Primary 'big' DOS (>= 32MB))
	start 63, size 3984057 (1945 Meg), flag 0
	beg: cyl 0/ head 1/ sector 1;
	end: cyl 247/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>


% fdisk -i /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=248 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=248 heads=255 sectors/track=63 (16065 blks/cyl)

Do you want to change our idea of what BIOS thinks ? [n] 
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 6 (0x06),(Primary 'big' DOS (>= 32MB))
	start 63, size 3984057 (1945 Meg), flag 0
	beg: cyl 0/ head 1/ sector 1;
	end: cyl 247/ head 254/ sector 63
Do you want to change it? [n] y

The static data for the slice 1 has been reinitialized to:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
	start 63, size 3984057 (1945 Meg), flag 80 (active)
	beg: cyl 0/ head 1/ sector 1;
	end: cyl 247/ head 254/ sector 63
Supply a decimal value for "sysid (165=FreeBSD)" [165] 6
Supply a decimal value for "start" [63] 
Supply a decimal value for "size" [3984057] 2088387
Explicitly specify beg/end address ? [n] 
sysid 6 (0x06),(Primary 'big' DOS (>= 32MB))
	start 63, size 2088387 (1019 Meg), flag 80 (active)
	beg: cyl 0/ head 1/ sector 1;
	end: cyl 129/ head 254/ sector 63
Are we happy with this entry? [n] y
The data for partition 2 is:
<UNUSED>
Do you want to change it? [n] y
Supply a decimal value for "sysid (165=FreeBSD)" [0] 165
Supply a decimal value for "start" [0] 2088421
Supply a decimal value for "size" [0] 1900000
fdisk: WARNING: partition does not start on a head boundary
fdisk: WARNING: partition does not end on a cylinder boundary
fdisk: WARNING: this may confuse the BIOS or some operating systems
Correct this automatically? [n] y
fdisk: WARNING: adjusting start offset of partition to 2088450
fdisk: WARNING: adjusting size of partition to 1895670
Explicitly specify beg/end address ? [n] 
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
	start 2088450, size 1895670 (925 Meg), flag 0
	beg: cyl 130/ head 0/ sector 1;
	end: cyl 247/ head 254/ sector 63
Are we happy with this entry? [n] y
The data for partition 3 is:
<UNUSED>
Do you want to change it? [n] 
The data for partition 4 is:
<UNUSED>
Do you want to change it? [n] 
Partition 1 is marked active
Do you want to change the active partition? [n] y
Supply a decimal value for "active partition" [1] 
Are you happy with this choice [n] y

We haven't changed the partition table yet.  This is your last chance.
parameters extracted from in-core disklabel are:
cylinders=248 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=248 heads=255 sectors/track=63 (16065 blks/cyl)

Information from DOS bootblock is:
1: sysid 6 (0x06),(Primary 'big' DOS (>= 32MB))
	start 63, size 2088387 (1019 Meg), flag 80 (active)
	beg: cyl 0/ head 1/ sector 1;
	end: cyl 129/ head 254/ sector 63
2: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
	start 2088450, size 1895670 (925 Meg), flag 0
	beg: cyl 130/ head 0/ sector 1;
	end: cyl 247/ head 254/ sector 63
3: <UNUSED>
4: <UNUSED>
Should we write new partition table? [n] y
fdisk: Geom not found: "da0"

% fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=248 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=248 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 6 (0x06),(Primary 'big' DOS (>= 32MB))
	start 63, size 2088387 (1019 Meg), flag 80 (active)
	beg: cyl 0/ head 1/ sector 1;
	end: cyl 129/ head 254/ sector 63
The data for partition 2 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
	start 2088450, size 1895670 (925 Meg), flag 0
	beg: cyl 130/ head 0/ sector 1;
	end: cyl 247/ head 254/ sector 63
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
% newfs_msdos -L DOS7 /dev/da0s1
/dev/da0s1: 2084280 sectors in 260535 FAT32 clusters (4096 bytes/cluster)
bps=512 spc=8 res=32 nft=2 mid=0xf0 spt=63 hds=255 hid=0 bsec=2088387 bspf=2036 rdcl=2 infs=1 bkbs=2
% bsdlabel -w -B da0s2
% newfs -L FBSD -U -n /dev/da0s2
/dev/da0s2: 925.6MB (1895668 sectors) block size 16384, fragment size 2048
	using 6 cylinder groups of 183.77MB, 11761 blks, 23552 inodes.
	with soft updates
super-block backups (for fsck -b #) at:
 160, 376512, 752864, 1129216, 1505568, 1881920
% boot0cfg -B -o noupdate /dev/da0
Проверка:

Код: Выделить всё

% mount_msdosfs /dev/da0s1 /mnt/
% mkdir -p /mnt/demo/etc/ && cp /etc/fstab /mnt/demo/etc/
% umount /mnt/
% mount_msdosfs /dev/da0s1 /media/
% df /media
Filesystem 1K-blocks Used   Avail Capacity  Mounted on
/dev/da0s1   1042148   24 1042124	 0%	/media
% find /media
/media
/media/demo
/media/demo/etc
/media/demo/etc/fstab
% umount /media/

% mount /dev/da0s2 /mnt/
% mkdir -p /mnt/demo2/etc2/ && cp /etc/resolv.conf /mnt/demo2/etc2/
% umount /mnt/
% mount /dev/da0s2 /media/
% find /media
/media
/media/demo2
/media/demo2/etc2
/media/demo2/etc2/resolv.conf
% df /media
Filesystem 1K-blocks Used  Avail Capacity  Mounted on
/dev/da0s2	912232	8 839246	 0%	/media
% umount /media/
Вот. Как видите без проблем с разбивкой. M2 и в телефоне работает. Хотелось бы таким же образом сделать USB-Flash.