Andriy Gapon | 2 Apr 2009 14:09
Picon

gpart micro-how-to


When I was a FreeBSD newbie I used sysinstall to partition my disks (now this
subset of sysinstall's functionality can be found in sade(1)); when I became more
knowledgeable and self-confident I started using fdisk and disklabel; and now it's
time for gpart.

Yesterday I marked up a new disk using part and decided to share the commands I
used just in case somebody finds it useful.

The disk is WD5000AAKS, its size in sectors is 976773168.

# the following is fdisk substitute: create mbr partition table
# and populate two entries with FreeBSD slices
gpart create -s mbr ad10
gpart add -b 63 -s 12578832 -t freebsd ad10
gpart add -b 12578895 -s 964194273 -t freebsd ad10

# the following are disklabel substitutes: create empty labels, then add ufs
# partition ad10s1a, swap partition ad10s1b and partition ad10s2d of type
# "unknown"/FS_OTHER/10 for future use by zfs
gpart create -s bsd ad10s1
gpart create -s bsd ad10s2
gpart add -i 1 -b 16 -s 4194304 -t freebsd-ufs ad10s1
gpart add -i 2 -b 4194320 -s 8384512 -t freebsd-swap ad10s1
gpart add -i 4 -b 16 -s 964194257 -t \!10 ad10s2

# the following are substitutes for fdisk/disklabel with -B/-b flags
gpart bootcode -b /boot/boot0 ad10
gpart bootcode -b /boot/boot ad10s1

(Continue reading)

Marcel Moolenaar | 2 Apr 2009 19:43
Picon

Re: gpart micro-how-to


On Apr 2, 2009, at 5:09 AM, Andriy Gapon wrote:

> # the following are disklabel substitutes: create empty labels, then  
> add ufs
> # partition ad10s1a, swap partition ad10s1b and partition ad10s2d of  
> type
> # "unknown"/FS_OTHER/10 for future use by zfs

The BSD scheme has a type for ZFS:
	#define FS_ZFS 27 /* Sun's ZFS */

You should be able to say:

	gpart create -s bsd ad10s2
	gpart add -i 4 -b 16 -s 964194257 -t freebsd-zfs ad10s2

This has been MFC'd it to 7-stable slightly more than a year
ago.

FYI,

--

-- 
Marcel Moolenaar
xcllnt <at> mac.com

Andriy Gapon | 2 Apr 2009 19:51
Picon

Re: gpart micro-how-to

on 02/04/2009 20:43 Marcel Moolenaar said the following:
> 
> On Apr 2, 2009, at 5:09 AM, Andriy Gapon wrote:
> 
>> # the following are disklabel substitutes: create empty labels, then
>> add ufs
>> # partition ad10s1a, swap partition ad10s1b and partition ad10s2d of type
>> # "unknown"/FS_OTHER/10 for future use by zfs
> 
> The BSD scheme has a type for ZFS:
>     #define FS_ZFS 27 /* Sun's ZFS */
> 
> You should be able to say:
> 
>     gpart create -s bsd ad10s2
>     gpart add -i 4 -b 16 -s 964194257 -t freebsd-zfs ad10s2
> 
> This has been MFC'd it to 7-stable slightly more than a year
> ago.

Thank you very much!
Stupid me was looking in src/sbin/bsdlabel, not in sys/sys/disklabel.h.

--

-- 
Andriy Gapon
Andrew Turner | 5 Apr 2009 07:50
Picon

FreeBSD NAND flash driver

I've been working on a FreeBSD NAND flash driver and NAND simulator [1].
I have tested reading and writing to the simulated NAND device but not
erasing.

It is not usable yet as the write will not perform any deletes from the
device, either the file system or another geom will have to issue
a BIO_DELETE followed by BIO_WRITE's to write to the disk. This is done
to support NAND flash aware file systems.

TODO:
 * ECC support.
 * Add GEOM attributes to get information about the NAND device out,
   eg. Block size, OOB data, etc.
 * Test the erase code.
 * Add support for real hardware.
 * Read the parameter page on parts that support it to get the required
   information.

Andrew

[1] http://fubar.geek.nz/files/freebsd/nand/freebsd-nand-20090405.tar.gz
Ivan Voras | 5 Apr 2009 14:57
Picon
Favicon
Gravatar

Re: FreeBSD NAND flash driver

Andrew Turner wrote:
> I've been working on a FreeBSD NAND flash driver and NAND simulator [1].
> I have tested reading and writing to the simulated NAND device but not
> erasing.

Hi,

Have you seen this:
http://lists.freebsd.org/pipermail/freebsd-arch/2009-April/009146.html ?

Is the new proposal actually obsolete?

> It is not usable yet as the write will not perform any deletes from the
> device, either the file system or another geom will have to issue
> a BIO_DELETE followed by BIO_WRITE's to write to the disk. This is done
> to support NAND flash aware file systems.
> 
> TODO:
>  * ECC support.
>  * Add GEOM attributes to get information about the NAND device out,
>    eg. Block size, OOB data, etc.
>  * Test the erase code.
>  * Add support for real hardware.
>  * Read the parameter page on parts that support it to get the required
>    information.
> 
> Andrew
> 
> [1] http://fubar.geek.nz/files/freebsd/nand/freebsd-nand-20090405.tar.gz

(Continue reading)

Andrew Turner | 5 Apr 2009 22:58
Picon

Re: FreeBSD NAND flash driver

On Sun, 05 Apr 2009 14:57:10 +0200
Ivan Voras <ivoras <at> freebsd.org> wrote:

> Andrew Turner wrote:
> > I've been working on a FreeBSD NAND flash driver and NAND simulator
> > [1]. I have tested reading and writing to the simulated NAND device
> > but not erasing.
> 
> Hi,
> 
> Have you seen this:
> http://lists.freebsd.org/pipermail/freebsd-arch/2009-April/009146.html ?

Yes. As I had written most of the code already I felt it would be
better to release it now than during the middle of the Summer of
Code so if the student is accepted they could work on the existing code base rather than duplicating work I
have already done.

There is still a lot of work to do on the driver before it is usable
including getting it working on real hardware.

Andrew
Stanislav Sedov | 6 Apr 2009 10:24
Picon
Favicon

Re: FreeBSD NAND flash driver


On Sun, 5 Apr 2009 17:50:14 +1200
Andrew Turner <andrew@...> mentioned:

> I've been working on a FreeBSD NAND flash driver and NAND simulator [1].
> I have tested reading and writing to the simulated NAND device but not
> erasing.

Great news!

> It is not usable yet as the write will not perform any deletes from the
> device, either the file system or another geom will have to issue
> a BIO_DELETE followed by BIO_WRITE's to write to the disk. This is done
> to support NAND flash aware file systems.
>

So, for ordinary file systems we're going to use the special geom layer
that will sit above the nand(8) device and perform BIO_DELETE operations
when required?

> TODO:
>  * ECC support.
>  * Add GEOM attributes to get information about the NAND device out,
>    eg. Block size, OOB data, etc.
>  * Test the erase code.
>  * Add support for real hardware.
>  * Read the parameter page on parts that support it to get the required
>    information.
> 
> Andrew
(Continue reading)

FreeBSD bugmaster | 6 Apr 2009 13:06
Picon
Favicon

Current problem reports assigned to freebsd-geom <at> FreeBSD.org

Note: to view an individual PR, use:
  http://www.freebsd.org/cgi/query-pr.cgi?pr=(number).

The following is a listing of current problems submitted by FreeBSD users.
These represent problem reports covering all versions including
experimental development code and obsolete releases.

S Tracker      Resp.      Description
--------------------------------------------------------------------------------
o bin/132845   geom       [geom] [patch] ggated(8) does not close files opened a
o kern/132273  geom       glabel(8): [patch] failing on journaled partition
o kern/132242  geom       [gmirror] gmirror.ko fails to fully initialize
o kern/131353  geom       [geom] gjournal(8) kernel lock
o kern/131037  geom       [geli] Unable to create disklabel on .eli-Device
o kern/130528  geom       gjournal fsck during boot
o kern/129674  geom       [geom] gjournal root did not mount on boot
o kern/129645  geom       gjournal(8): GEOM_JOURNAL causes system to fail to boo
o kern/129245  geom       [geom] gcache is more suitable for suffix based provid
o bin/128398   geom       [patch] glabel(8): teach geom_label to recognise gpt l
f kern/128276  geom       [gmirror] machine lock up when gmirror module is used
o kern/126902  geom       [geom] geom_label: kernel panic during install boot
o kern/124973  geom       [gjournal] [patch] boot order affects geom_journal con
o kern/124969  geom       gvinum(8): gvinum raid5 plex does not detect missing s
o kern/124294  geom       [geom] gmirror(8) have inappropriate logic when workin
o kern/124130  geom       [gmirror] [usb] gmirror fails to start usb devices tha
o kern/123962  geom       [panic] [gjournal] gjournal (455Gb data, 8Gb journal),
o kern/123630  geom       [patch] [gmirror] gmirror doesnt allow the original dr
o kern/123122  geom       [geom] GEOM / gjournal kernel lock
f kern/122415  geom       [geom] UFS labels are being constantly created and rem
o kern/122067  geom       [geom] [panic] Geom crashed during boot
(Continue reading)

Andrew Turner | 6 Apr 2009 13:25
Picon

Re: FreeBSD NAND flash driver

On Mon, 6 Apr 2009 12:24:10 +0400
Stanislav Sedov <stas <at> FreeBSD.org> wrote:
> > It is not usable yet as the write will not perform any deletes from
> > the device, either the file system or another geom will have to
> > issue a BIO_DELETE followed by BIO_WRITE's to write to the disk.
> > This is done to support NAND flash aware file systems.
> >
> 
> So, for ordinary file systems we're going to use the special geom
> layer that will sit above the nand(8) device and perform BIO_DELETE
> operations when required?
Yes, this is intentional as NAND flash is split up to blocks. The
blocks are then split into pages. You have to erase the entire block at
a time but can write pages as required. A file system that knows about
this difference will be able to talk to nand(8) directly.

>  
> > TODO:
> >  * ECC support.
> >  * Add GEOM attributes to get information about the NAND device out,
> >    eg. Block size, OOB data, etc.
> >  * Test the erase code.
> >  * Add support for real hardware.
> >  * Read the parameter page on parts that support it to get the
> > required information.
> > 
> > Andrew
> > 
> > [1]
> > http://fubar.geek.nz/files/freebsd/nand/freebsd-nand-20090405.tar.gz
(Continue reading)

Aragon Gouveia | 6 Apr 2009 16:04

Re: FreeBSD NAND flash driver

Hi,

Andrew Turner wrote:
> Yes, this is intentional as NAND flash is split up to blocks. The
> blocks are then split into pages. You have to erase the entire block at
> a time but can write pages as required. A file system that knows about
> this difference will be able to talk to nand(8) directly.

What I know about file systems and UFS is pretty limited, so forgive me 
if what follows are silly questions.

Are there any defragmentation routines in UFS that could/should be 
disabled when using it on a flash device?  I know a file system can be 
optimized for space or time with tunefs(8).  I imagine optimizing for 
space would be best for a flash device?  Is there anything else other 
than that and your work that can improve flash support?

Thanks,
Aragon


Gmane