Re: Format a USB flash drive using gpart

2012-07-09 Thread Bruce Cran

On 08/07/2012 13:10, Warren Block wrote:
bsdinstall(8) has a curses partition editor.  There is probably a 
trick needed to use that outside of an install context.


Just run bsdinstall partedit.

--
Bruce Cran
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-09 Thread Polytropon
On Sun, 08 Jul 2012 23:27:23 -0400, Thomas Mueller wrote:
 You mean the non-subdivided 1.44 MB or other capacity of a floppy
 is called a partition?

Let's try to use the correct terminology.

If you're talking about an MS-DOS disk, then yes, it contains
a DOS partition which is formatted. In FreeBSD, we would call
it a slice (slice == DOS primary partition). In this case,
there is no (sub)partitioning, the _slice_ carries the MS-DOS
file system here. You know that MS-DOS does not have support
for partitioning.



 Same question for CDs?

Not sure. A CD contains an ISO-9660 file system without an
enclosing partition per se.

If we look back into OS history, we find the magical 'c' partition.
Historically, partition letters have been reserved for specific
purposes: the 'a' partition means a bootable partition, 'b' is
a swap partition, and 'c' is the whole disk, refering either
to the disk device (da0c == da0) or the whole slice (da0s1c == da0s1).

You _can_ put a UFS file system, even many of them, on a CD, that
is possible, but don't expect any Windows to be able to deal
with it. :-)



 Also, a file system can be contained in an image file.  Or is this
 a virtual partition?

As devices and real files are quite the same, you can mount
a file system that is contained in a file. You typically do this
when doing data recovery and forensic analysis, where your starting
point is an image file of a disk, a slice or a partition. You
then connect it to a virtual node (vnconfig - e. g. md0) and
then you mount it as if it was a device file.



 Might 
  # tar xf /dev/da0
 work in other BSDs or even other (quasi-)Unixes including Linux,
 using the appropriate device name where applicable in place of da0?

That's quite possible. I've been speaking about tar as the most
universal file system which isn't one -- I've been using it on
floppies many many years ago, to transfer data among Sun Sparcstations,
Linux workstations and a BSD server. It's important not to use
any fancy tar features, and of course you need to know the
device names corresponding to the floppy drive which differ
across the systems, but it is possible to first use fdformat,
then tar cf, then tar xf. This of course happened before the
dawn of networking. :-)



 While that particular construst could probably not be booted,
 it is possible to boot from a floppy or image file that does
 not contain a file system.

For bare booting, a file system isn't that essential. You just
have to make sure the boot chain is properly resolved, such
as for example the FreeBSD boot mechanism works. You can read
more about it in man 8 boot.



 Some of the disk images on the System Rescue CD (sysresccd.org)
 are not viewable/mountable as file systems.

I haven't looked into this particular one, but that is very well
possible. A CD doesn't _need_ to be in a ISO-9660 format (even
though it's the default data format). The _implementation_ of
the boot mechanism matters: it could even select from several
different boot images stored in some arbitrary (but addressable)
manner on the CD.




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-09 Thread Wojciech Puchar

If you're talking about an MS-DOS disk, then yes, it contains
a DOS partition which is formatted. In FreeBSD, we would call
it a slice (slice == DOS primary partition). In this case,
there is no (sub)partitioning, the _slice_ carries the MS-DOS


unless you need windows 98 support partitionless USB drives works 
absolutely fine


clear it out

dd if=/dev/zero of=/dev/da0 bs=64k count=1


format

newfs_msdos /dev/da0


Same question for CDs?


Not sure. A CD contains an ISO-9660 file system without an
enclosing partition per se.

In FreeBSD (as well as NetBSD, OpenBSD, maybe linux) CD is just block 
device. You may make disklabel on it, and whatever you like.



In excuse of OS (windows) CD/DVD MUST BE CD9660 or UDF formatted without 
partitions.


You may record NTFS formatted DVD, perfectly readable on FReeBSD, 
unreadable under windows in spite it is windows native filesystem.


--
You may actually make hybrid DVD that will show whatever you want under 
windoze, and have real data in tar format.


below the recipe:

1) prepare windows-vizible layout, all needed viruses and autorun.inf in 
some directory and do


mkisofs -J -q .|dd of=/path/to/tempfile bs=512 skip=1

2)

tar cf - /path/to/tempfile ...list of what you want to be tarred...|growisofs 
-dvd-compat -Z /dev/cd0=-


now use tar to read files from that DVD, while in windows it will run 
viruses properly.




a virtual partition?


As devices and real files are quite the same, you can mount
a file system that is contained in a file. You typically do this
when doing data recovery and forensic analysis, where your starting
point is an image file of a disk, a slice or a partition. You
then connect it to a virtual node (vnconfig - e. g. md0) and


vnconfig is quite in old FreeBSD
today it is mdconfig

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-09 Thread Bruce Cran

On 09/07/2012 11:16, Polytropon wrote:

If you're talking about an MS-DOS disk, then yes, it contains
a DOS partition which is formatted. In FreeBSD, we would call
it a slice (slice == DOS primary partition). In this case,
there is no (sub)partitioning, the _slice_ carries the MS-DOS
file system here. You know that MS-DOS does not have support
for partitioning.


Floppy disks aren't partitioned/sliced - they use 'dangerously 
dedicated' mode, containing nothing except the filesystem. The way you'd 
mount it would be:


mount /dev/fd0 /mnt/point

You can do the same with a normal USB or other disk using:

newfs /dev/da0
mount /dev/da0 /mnt/point

The reason it's called 'dangerously dedicated' I think is that other 
systems - or even the same system months/years later if you forget and 
run the wrong tools - won't know there's a filesystem there and it's 
easy to think the disk's empty.  If you're on an old system and run 
'gpart show da0' and don't see a partition table it's quite easy to 
forget to check if da0 itself contains a filesystem.


When using GPT what were called slices are now partitions, and instead 
of 'ada0s1a' (disk 0, slice 1, partition a) you just have 'ada0p1'. A 
partition table supports up to 4096 entries (gpart creates one 
supporting 128 by default) so there's no need for the freebsd container 
any more - you just create freebsd-boot, freebsd-ufs, freebsd-zfs, 
freebsd-swap entries e.g. 'gpart add -t freebsd-ufs -s 64g da0'.


--
Bruce Cran
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-09 Thread Wojciech Puchar

Floppy disks aren't partitioned/sliced - they use 'dangerously dedicated'


they use dangerously obsolete mode. nobody use them at all.

disk's empty.  If you're on an old system and run 'gpart show da0' and don't 
see a partition table it's quite easy to forget to check if da0 itself 
contains a filesystem.


unless it is a normal way of using it.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-09 Thread Bruce Cran

On 09/07/2012 13:17, Wojciech Puchar wrote:

they use dangerously obsolete mode. nobody use them at all.



A company I worked with were still distributing files on floppy disks as 
recently as 2009. They _are_ obsolete, but I suspect plenty of people 
still use them.



unless it is a normal way of using it.


That's right - I was thinking of my system where I destroyed all the 
data on a HDD because it didn't have a partition table. When I ran the 
FreeBSD installer and saw the disk was 'empty' I forgot it had a 
filesystem and reformatted it. Obviously people using floppy or USB 
disks would be more ready for there to be data on the disk without a 
partition table.


--
Bruce Cran

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-09 Thread Wojciech Puchar
A company I worked with were still distributing files on floppy disks as 
recently as 2009.

quite funny :)

They _are_ obsolete, but I suspect plenty of people still 
use them.



unless it is a normal way of using it.


That's right - I was thinking of my system where I destroyed all the data on 
a HDD because it didn't have a partition table. When I ran the FreeBSD 
only your fault, not FreeBSD. Why you connected your data disk at first 
place.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-09 Thread Bruce Cran

On 09/07/2012 13:29, Wojciech Puchar wrote:
only your fault, not FreeBSD. Why you connected your data disk at 
first place.


I didn't say it was FreeBSD's fault. If I thought it was, I would have 
fixed it!


--
Bruce Cran
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-09 Thread Ian Smith
On Sun, 8 Jul 2012 21:00:40 +0100, Bruce Cran wrote:
  On 08/07/2012 16:06, Ian Smith wrote:
   In general they're not distinct in usage from any other type of disk.
  
  The more expensive disks of course support TRIM so you'd want to pass -t to
  newfs to enable it.

Thanks.  Next time I blow around AU$455 on a 120GB flashdrive, I'll be 
glad to be better informed about getting the most out of it :)

At least with sysinstall|sade you can set extra newfs options such as 
-t, and as importantly for me, you can toggle whether or not to newfs 
particular partition/s, such as leaving say /home alone on an existing 
partitioning, which didn't seem straightforward with bsdinstall last I 
tried (admittedly at 9.0-BETA1) but I've not followed later updates.

I might take Matthew's suggestion and try the PCBSD 9 installer; I did 
boot a PCBSD 8 memstick at one stage, and was surprisingly impressed -
or I could use freebsd-update instead of sources to go from 7.4 to 9.1

It's the options that drive ya crazy -- Silly Symphony C.'83

cheers, Ian
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-09 Thread Warren Block

On Mon, 9 Jul 2012, Bruce Cran wrote:


On 09/07/2012 11:16, Polytropon wrote:

If you're talking about an MS-DOS disk, then yes, it contains
a DOS partition which is formatted. In FreeBSD, we would call
it a slice (slice == DOS primary partition). In this case,
there is no (sub)partitioning, the _slice_ carries the MS-DOS
file system here. You know that MS-DOS does not have support
for partitioning.


Floppy disks aren't partitioned/sliced - they use 'dangerously dedicated' 
mode, containing nothing except the filesystem.


Dangerously dedicated refers to a disk with a bsdlabel partition table 
and boot block.  Floppies don't have even that, it's just a raw 
filesystem.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-09 Thread Jerry McAllister
On Mon, Jul 09, 2012 at 07:44:28AM +0200, Wojciech Puchar wrote:

 You don't.  You wipe the FAT32 with fdisk and make a FreeBSD slice on it.
 Then you can bsdlabel it with one partition and newfs it.  Or you can
 
 repeat 100 times more that you have to make fdisk and bsdlabel. you 
 don't, and it doesn't make sense

You can do many things as indicated in several posts and most of them 
will work if you want it that way.   But, they do not answer the
question as posted.

Turning the USB stick into a FreeBSD type or mounting it as MSDOSFS
does answer that question.   

I am not sure why the rabid promotion of non-slicing, but it not
worth all the extra bandwidth applied to it.

jerry



 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Wojciech Puchar

Magdeburg, Germany


I have used gpart to partition a USB flash drive into FreeBSD boot partition, 
root partition and swap partition.


making swap partition on USB pendrive is at least stupid. if you won't 
swap at all - wasted space.
If you will it would be so slow and wear USB pendrive so quickly that you 
certainly don't want this.



bsdlabel -w device

bsdabel -e  device and make a partition start from 0 to end, 4.2BSD

newfs it

bsdlabel -B

and put everything in one partition.

make heavy use of tmpfs, make sure noatime is put in fstab to limit writes 
to pendrive.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Polytropon
On Sat, 07 Jul 2012 17:45:17 -0400, Thomas Mueller wrote:
 Does a USB flash drive also work as a giant floppy, no partitions? 
 Can you make a flash drive bootable when nonpartitioned and
 formatted that way?

Yes, that's exactly what my advice was aiming to, but let's
try to keep the terminology clean: You cannot do without
partitions. A partition carries a file system.

You _can_ do without slices. A slice holds one or more partitions.
A slice is a DOS primary partition. Omitting it is called
dedicated mode. There may be some circumstances where a
dedicated disk doesn't boot. Personally I haven't met one,
but it's still possible due to BIOSes expecting MS-DOS-alike
structures.

For the file system side, it's just a matter of having
created one partition covering the whole disk, newfs and
tunefs it, and install the boot code. Wojciech Puchar did
already explain how this works and which tools are involved.

However, there _is_ a way to make a giant floppy without a
file system (as you said without partitions, and I'll take
that literally): You can use tar, the universal file system
that isn't a file system to write data to the USB stick.

Writing stuff:

# tar cf /dev/da0 /my/files

Reading stuff:

# tar xf /dev/da0

This works, but it may appear that no other system can read it.
If you consider using it for FreeBSD only, no problem. The big
advantage: You don't need to mount and umount the stick.

I'm assume _that_ construct cannot be booted.


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Polytropon
On Sun, 8 Jul 2012 09:49:30 +0200 (CEST), Wojciech Puchar wrote:
  Magdeburg, Germany
 
  I have used gpart to partition a USB flash drive into FreeBSD boot 
  partition, root partition and swap partition.
 
 making swap partition on USB pendrive is at least stupid. if you won't 
 swap at all - wasted space.
 If you will it would be so slow and wear USB pendrive so quickly that you 
 certainly don't want this.
 
 
 bsdlabel -w device
 
 bsdabel -e  device and make a partition start from 0 to end, 4.2BSD
 
 newfs it
 
 bsdlabel -B
 
 and put everything in one partition.
 
 make heavy use of tmpfs, make sure noatime is put in fstab to limit writes 
 to pendrive.

An addition: You can label the a partition (e. g. /dev/da0a)
or use its UFSID in /etc/fstab, so you don't depend on the
exact device name, which in turn depends on the detection
order of mass storage which is hard to predict.

I'd like to recommend reading for details:
http://www.wonkity.com/~wblock/docs/html/disksetup.html
and
http://www.freebsd.org/doc/handbook/geom-glabel.html



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Carmel
On Sat, 7 Jul 2012 20:36:36 -0600 (MDT)
Warren Block articulated:

 On Sat, 7 Jul 2012, Carmel wrote:
 
  This is probably a dumb question, but does gpart even work on a USB
  flash drive? I have not been able to figure out how to do it. I
  want to erase the entire drive and format it for a FreeBSD UFS2
  file system.
 
 Yes, gpart will work with pretty much any storage device.
 
 If you want the drive to be bootable, it needs boot blocks.  This is 
 easier with GPT than MBR.  For an 8G drive:
 
 # gpart create -s gpt da0
 # gpart add -t freebsd-boot -s 512k da0
 # gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da0
 # gpart add -t freebsd-ufs -b 1M -s 7G da0
 # gpart add -t freebsd-swap da0
 # newfs -U /dev/da0p2

Thanks Warren, you win the prize for the most detailed answer.
Polytropon gave me the easiest answer if I just want to use the drive
as a simple storage device; however, if at some point I actually want
to go beyond that your answer is what I would require.

Interestingly enough, I searched through the man pages and FreeBSD help
but never came across anything that specifically addressed flash drive.
Perhaps I was just not looking hard enough.

Perhaps, and I know that this will offend some purists, but a nice GUI
that would do what your instructions detail above would be helpful.
There is no way that I am going to remember all of those instructions in
six months time. Just my 2¢.

-- 
Carmel ✌
carmel...@hotmail.com

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Polytropon
On Sun, 8 Jul 2012 07:41:59 -0400, Carmel wrote:
 Perhaps, and I know that this will offend some purists, but a nice GUI
 that would do what your instructions detail above would be helpful.
 There is no way that I am going to remember all of those instructions in
 six months time. Just my 2¢.

Why not put the commands into a text file locally?
Try _that_ with a GUI. :-)

I'm almost sure KDE or Gnome offer means to initialize mass
storage, but because those seem to be quite Linux-centric,
it's possible FreeBSD's system tools won't be utilized. So
with using the commands provided by Warren, you will be fine
every time. If you practice them regularly, you will remember
them, and if you do so, you'll surely write a script that
allows you to automate the task so you can forget the commands
again. :-)


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Warren Block

On Sun, 8 Jul 2012, Carmel wrote:


Yes, gpart will work with pretty much any storage device.

If you want the drive to be bootable, it needs boot blocks.  This is
easier with GPT than MBR.  For an 8G drive:

# gpart create -s gpt da0
# gpart add -t freebsd-boot -s 512k da0
# gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da0
# gpart add -t freebsd-ufs -b 1M -s 7G da0
# gpart add -t freebsd-swap da0
# newfs -U /dev/da0p2


Thanks Warren, you win the prize for the most detailed answer.
Polytropon gave me the easiest answer if I just want to use the drive
as a simple storage device; however, if at some point I actually want
to go beyond that your answer is what I would require.

Interestingly enough, I searched through the man pages and FreeBSD help
but never came across anything that specifically addressed flash drive.
Perhaps I was just not looking hard enough.


FreeBSD sees no significant difference between a flash drive and a disk 
drive.  They are treated the same.



Perhaps, and I know that this will offend some purists, but a nice GUI
that would do what your instructions detail above would be helpful.
There is no way that I am going to remember all of those instructions in
six months time. Just my 2¢.


bsdinstall(8) has a curses partition editor.  There is probably a trick 
needed to use that outside of an install context.  I find gpart easier.___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

Re: Format a USB flash drive using gpart

2012-07-08 Thread Wojciech Puchar


Interestingly enough, I searched through the man pages and FreeBSD help
but never came across anything that specifically addressed flash drive.


because there is no need to. For freebsd it is just a storage device.

for FreeBSD only i recommend using bsdlabel, not gpart, for multiOS using 
fdisk.


it is simpler and boot0cfg allows you to add boot selector, so you can 
make multisystem pendrive, just as my triple-boot 16GB pendrive holding 
FreeBSD/i386, FreeBSD/amd64, lots of packages, DOS with lots of tools and 
windoze installers.



Perhaps, and I know that this will offend some purists, but a nice GUI


not about purism but (lack of) usability.

GUI interfaces never helps, only hides real things and prevent 
understanding anything. You maybe understand it, maybe not. Most people 
will not.


GUI interfaces are actual a PROBLEM with today software.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Wojciech Puchar

with using the commands provided by Warren, you will be fine
every time. If you practice them regularly, you will remember
them, and if you do so, you'll surely write a script that


after doing

man gpart

he will understand it, so remembering is easy.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Polytropon
On Sun, 8 Jul 2012 14:16:31 +0200 (CEST), Wojciech Puchar wrote:
  Perhaps, and I know that this will offend some purists, but a nice GUI
 
 not about purism but (lack of) usability.
 
 GUI interfaces never helps, only hides real things and prevent 
 understanding anything. You maybe understand it, maybe not. Most people 
 will not.
 
 GUI interfaces are actual a PROBLEM with today software.

The main problem here is that you have no efficient way of
documentation. What do you want to do? Describe pictures?
And as soon as the GUI changes (e. g. different toolkit
version), things may change, not look the same anymore.

Also GUIs seem to be limited, especially if you want to
apply options that make better use of characteristics of
a flash drive (compared to a regular hard disk). A GUI
disk initializer would have to take _every_ possibility
into mind, everything that might be specific to the OS
it runs on (as for example Linux differs from FreeBSD
filesystem-wise), making things much more complicated
than they need to.

With few routine, tasks are performed more natural using
the desired CLI tools. You don't go Now I have to remember
which command to format the disk, you just format the disk,
which means spaking to newfs. The more often you do it,
the more obvious the tools are, and they won't change in
look and feel (or options). That makes them superior.

I admit that they might be confusing for people who do not
want to read, learn and practice. That's okay. Those should
use GUI tools and live with the (limited) set of selections
they are presented. As there is no real distinction between
user and administrator anymore, this is something we need
to live with.

That being said, CLI tools offer the easier interface to
the more advanced functionality and better flexibility, which
is especially useful in the discussed case: initializing a
USB flash drive that might need different options than what
you could default to for a regular disk drive.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Bruce Cran

On 08/07/2012 13:30, Polytropon wrote:

With few routine, tasks are performed more natural using
the desired CLI tools. You don't go Now I have to remember
which command to format the disk, you just format the disk,
which means spaking to newfs. The more often you do it,
the more obvious the tools are, and they won't change in
look and feel (or options). That makes them superior.


How do you format a FAT32 partition? newfs won't work. Is it newfs_vfat, 
newfs_fat32, newfs_msdos etc.? And how do you specify you want FAT32 
instead of FAT12 or FAT16? With a good GUI tool like diskmgmt.msc in 
Windows 2008 you simply right-click the partition and click New Volume 
to create a new partition, or Format to format it - and then follow 
the prompts.  Of course using diskpart is faster if you know the 
commands and parameters, but for an ordinary user adding a new disk 
maybe once a year it's most likely more efficient to just use the GUI.


--
Bruce Cran
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Polytropon
On Sun, 08 Jul 2012 14:27:05 +0100, Bruce Cran wrote:
 On 08/07/2012 13:30, Polytropon wrote:
  With few routine, tasks are performed more natural using
  the desired CLI tools. You don't go Now I have to remember
  which command to format the disk, you just format the disk,
  which means spaking to newfs. The more often you do it,
  the more obvious the tools are, and they won't change in
  look and feel (or options). That makes them superior.
 
 How do you format a FAT32 partition? newfs won't work. Is it newfs_vfat, 
 newfs_fat32, newfs_msdos etc.? And how do you specify you want FAT32 
 instead of FAT12 or FAT16?

In such cases, you use the _proper_ CLI tools for that job.
As I said, those are typically specific to the file system
one wants to use, and depending on the file system design,
there may be options that are individual to those tools.
For every fs-related task, there is a system-level tool
that does the job.



 With a good GUI tool like diskmgmt.msc in 
 Windows 2008 you simply right-click the partition and click New Volume 
 to create a new partition, or Format to format it - and then follow 
 the prompts. 

And of course you cannot create UFS partitions that way. :-)

I still remember the initalize disk function from the original
Amiga or Atari ST graphical interfaces. They were bound to those
systems and their supported file systems. Intending to have
something similar (a GUI) for UNIX and Linux would be possible,
but very complicated under the hood, and it would be even more
complicated to make all that power utilizable to a novice user.
In that specific case, reasonable defaults would have to be
provided, which typically fail in edge cases. This is where you
use the power of CLI.

Another advantage: It's less interactive, giving you potential
for automating tasks. Follow the prompts might even be too
complicated for some kinds of users. :-)



 Of course using diskpart is faster if you know the 
 commands and parameters, but for an ordinary user adding a new disk 
 maybe once a year it's most likely more efficient to just use the GUI.

If the GUI takes the considerations about file system and media
type (and their implications) into mind -- no problem. Sadly, I
don't know of a tool yet that exactly works that way.

Especially in trial  error scenarios the CLI is simpler in
use. For example, you compose a newfs command. Then you apply
it. Not happy with the result? Recall the command from the
command line history, change the parameters you want, and then
try again. It's surely harder to do that within a GUI. :-)

On the other hand, a proper tool would efficiently visualize
the content of a disk, showing how slices and partitions are
laid out and what options they have. This is a real benefit
in testing scenarios where you need a quick overview of the
status quo.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Ian Smith
In freebsd-questions Digest, Vol 422, Issue 10, Message: 29
On Sun, 8 Jul 2012 07:41:59 -0400 Carmel carmel...@hotmail.com wrote:
  On Sat, 7 Jul 2012 20:36:36 -0600 (MDT)
  Warren Block articulated:
  
   On Sat, 7 Jul 2012, Carmel wrote:
   
This is probably a dumb question, but does gpart even work on a USB
flash drive? I have not been able to figure out how to do it. I
want to erase the entire drive and format it for a FreeBSD UFS2
file system.
   
   Yes, gpart will work with pretty much any storage device.
   
   If you want the drive to be bootable, it needs boot blocks.  This is 
   easier with GPT than MBR.  For an 8G drive:
   
   # gpart create -s gpt da0
   # gpart add -t freebsd-boot -s 512k da0
   # gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da0
   # gpart add -t freebsd-ufs -b 1M -s 7G da0
   # gpart add -t freebsd-swap da0
   # newfs -U /dev/da0p2
  
  Thanks Warren, you win the prize for the most detailed answer.
  Polytropon gave me the easiest answer if I just want to use the drive
  as a simple storage device; however, if at some point I actually want
  to go beyond that your answer is what I would require.
  
  Interestingly enough, I searched through the man pages and FreeBSD help
  but never came across anything that specifically addressed flash drive.
  Perhaps I was just not looking hard enough.

In general they're not distinct in usage from any other type of disk.

  Perhaps, and I know that this will offend some purists, but a nice GUI
  that would do what your instructions detail above would be helpful.
  There is no way that I am going to remember all of those instructions in
  six months time. Just my 2¢.

Well one of the reasons I'm replying to this is to keep a copy of 
Warren's recipe handy :)  Another is to point out that rumours of the 
death of MBR partitioning, especially on small disks, are premature.

I know your question specified gpart, but the easiest way I know of to 
put UFS filesystems on flash drives is to use sade(8), incorporating the 
fdisk  bsdlabel  newfs functions from sysinstall .. it still works as 
well as ever, however old-fashioned or deprecated some may call it.

sade's GUI at the curses level :) and does all the heavy maths for you, 
both for slicing the disk and partitioning the slice(s).  As mentioned 
in boot0cfg(8), you have to set  # sysctl kern.geom.debugflags=16
before sade (or anything) can write to any GEOM disk's boot sectors.  
Remember to reset it to 0 later.

You might even like to put a small msdosfs slice first, so you can use 
some of that stick to transfer files between UFS and DOS systems.  And 
yes you can multiboot from a memstick if you (or sade) put boot0 on it, 
assuming your computer supports booting from USB drives.

I don't know what the gpart equivalent of boot0 is, if there is one yet? 
Last I heard, seemed you had to use Linux tools to multiboot GPT disks.

There was some muttering about updating sade to handle GPT too .. that 
would be very welcome, maybe restoring some of the lost functionality 
from sysinstall/sade back into bsdinstall, both for GPT and MBR systems.

cheers, Ian___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

Re: Format a USB flash drive using gpart

2012-07-08 Thread Wojciech Puchar

I know your question specified gpart, but the easiest way I know of to
put UFS filesystems on flash drives is to use sade(8), incorporating the
the easiest way to put UFS filesystem on flash drives is to ... put 
UFS filesystem using newfs command.


You DO NOT NEED any partitioning.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Bruce Cran

On 08/07/2012 16:06, Ian Smith wrote:

In general they're not distinct in usage from any other type of disk.


The more expensive disks of course support TRIM so you'd want to pass -t 
to newfs to enable it.


--
Bruce Cran
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Wojciech Puchar

In general they're not distinct in usage from any other type of disk.


The more expensive disks of course support TRIM so you'd want to pass -t to 
newfs to enable it.

can you give me an example of pendrive that supports TRIM?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Bruce Cran

On 08/07/2012 21:51, Wojciech Puchar wrote:

can you give me an example of pendrive that supports TRIM?


LaCie FastKey 
(http://www.tomshardware.co.uk/usb-3.0-thumb-drive-flash-drive,review-32174-5.html).


--
Bruce Cran
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Wojciech Puchar

seems like SSD style controller+USB 3.0 bridge. sizes suggest this.

thanks.

On Sun, 8 Jul 2012, Bruce Cran wrote:


On 08/07/2012 21:51, Wojciech Puchar wrote:

can you give me an example of pendrive that supports TRIM?


LaCie FastKey 
(http://www.tomshardware.co.uk/usb-3.0-thumb-drive-flash-drive,review-32174-5.html).


--
Bruce Cran


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Thomas Mueller
On Sat, 07 Jul 2012 17:45:17 -0400, Thomas Mueller wrote:
 Does a USB flash drive also work as a giant floppy, no partitions?
 Can you make a flash drive bootable when nonpartitioned and
 formatted that way?

Polytropon responded:

 Yes, that's exactly what my advice was aiming to, but let's
 try to keep the terminology clean: You cannot do without
 partitions. A partition carries a file system.

 You _can_ do without slices. A slice holds one or more partitions.
 A slice is a DOS primary partition. Omitting it is called
 dedicated mode. There may be some circumstances where a
 dedicated disk doesn't boot. Personally I haven't met one,
 but it's still possible due to BIOSes expecting MS-DOS-alike
 structures.

 For the file system side, it's just a matter of having
 created one partition covering the whole disk, newfs and
 tunefs it, and install the boot code. Wojciech Puchar did
 already explain how this works and which tools are involved.

 However, there _is_ a way to make a giant floppy without a
 file system (as you said without partitions, and I'll take
 that literally): You can use tar, the universal file system
 that isn't a file system to write data to the USB stick.

 Writing stuff:

 # tar cf /dev/da0 /my/files

 Reading stuff:

 # tar xf /dev/da0

 This works, but it may appear that no other system can read it.
 If you consider using it for FreeBSD only, no problem. The big
 advantage: You don't need to mount and umount the stick.

 I'm assume _that_ construct cannot be booted.

You mean the non-subdivided 1.44 MB or other capacity of a floppy is called a 
partition?

Same question for CDs?

One does not usually think of something that can't be created by subdividing as 
a partition.

Also, a file system can be contained in an image file.  Or is this a virtual 
partition?

Might 
 # tar xf /dev/da0
work in other BSDs or even other (quasi-)Unixes including Linux, using the 
appropriate device name where applicable in place of da0?

While that particular construst could probably not be booted, it is possible to 
boot from a floppy or image file that does not contain a file system.

Some of the disk images on the System Rescue CD (sysresccd.org) are not 
viewable/mountable as file systems.

Tom
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Jerry McAllister
On Sun, Jul 08, 2012 at 02:27:05PM +0100, Bruce Cran wrote:

 On 08/07/2012 13:30, Polytropon wrote:
 With few routine, tasks are performed more natural using
 the desired CLI tools. You don't go Now I have to remember
 which command to format the disk, you just format the disk,
 which means spaking to newfs. The more often you do it,
 the more obvious the tools are, and they won't change in
 look and feel (or options). That makes them superior.
 
 How do you format a FAT32 partition? 

You don't.  You wipe the FAT32 with fdisk and make a FreeBSD slice on it.
Then you can bsdlabel it with one partition and newfs it.  Or you can 
use the gpart tools with I am not yet familiar.   But, in any case,
the FAT32 is irrelevant.  You just overwrite that with the FreeBSD stuff.

If you have a FAT32 on it and if you want to use it as a FAT32, then you 
leave the FAT32 alone and just mount the thing as type msdosfs.

Make a mount point for it.  I commonly use /stick
Add something like the following in your /etc/fstab

  /dev/da2s1  /stick  msdosfs rw,noauto   0   0

and then do 
  #mount /stick  
on the command line.

You will have to figure out the correct /dev/...  address for it.
Generally you dan find the info in dmesg.

jerry  

newfs won't work. Is it newfs_vfat, 
 newfs_fat32, newfs_msdos etc.? And how do you specify you want FAT32 
 instead of FAT12 or FAT16? With a good GUI tool like diskmgmt.msc in 
 Windows 2008 you simply right-click the partition and click New Volume 
 to create a new partition, or Format to format it - and then follow 
 the prompts.  Of course using diskpart is faster if you know the 
 commands and parameters, but for an ordinary user adding a new disk 
 maybe once a year it's most likely more efficient to just use the GUI.
 
 -- 
 Bruce Cran
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Wojciech Puchar

You don't.  You wipe the FAT32 with fdisk and make a FreeBSD slice on it.
Then you can bsdlabel it with one partition and newfs it.  Or you can


repeat 100 times more that you have to make fdisk and bsdlabel. you 
don't, and it doesn't make sense

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-08 Thread Wojciech Puchar

file system (as you said without partitions, and I'll take
that literally): You can use tar, the universal file system
that isn't a file system to write data to the USB stick.




which is best in USB pendrive wear and speed point of view.

pendrive's flash translation layers are just awful, only linear writes 
works well.



Writing stuff:



# tar cf /dev/da0 /my/files


i would recomment

tar -b 128 -cf /dev/da0 /my/files


Might
# tar xf /dev/da0
work in other BSDs or even other (quasi-)Unixes including Linux, using the 
appropriate device name where applicable in place of da0?


yes it will run fine under linux, openbsd, netbsd, slowlaris etc.



While that particular construst could probably not be booted, it is possible to 
boot from a floppy or image file that does not contain a file system.


If you need bootable pendrive then you have to use disklabel and make 
filesystem.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Format a USB flash drive using gpart

2012-07-07 Thread Carmel
This is probably a dumb question, but does gpart even work on a USB
flash drive? I have not been able to figure out how to do it. I want to
erase the entire drive and format it for a FreeBSD UFS2 file system.

-- 
Carmel ✌
carmel...@hotmail.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-07 Thread Polytropon
On Sat, 7 Jul 2012 13:15:10 -0400, Carmel wrote:
 This is probably a dumb question, but does gpart even work on a USB
 flash drive? I have not been able to figure out how to do it. I want to
 erase the entire drive and format it for a FreeBSD UFS2 file system.

In that case, screw slices and partitions 'n stuff. :-)

# newfs /dev/da0

This is all you need (see man newfs and man tunefs for
options you might need to optimize utilization, and check
best fitting options for /etc/fstab, e. g. noatime if you
are not going to need it).


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-07 Thread Thomas Mueller
 On Sat, 7 Jul 2012 13:15:10 -0400, Carmel wrote:
  This is probably a dumb question, but does gpart even work on a USB
  flash drive? I have not been able to figure out how to do it. I want to
  erase the entire drive and format it for a FreeBSD UFS2 file system.

 In that case, screw slices and partitions 'n stuff. :-)

 # newfs /dev/da0

 This is all you need (see man newfs and man tunefs for
 options you might need to optimize utilization, and check
 best fitting options for /etc/fstab, e. g. noatime if you
 are not going to need it).


 Polytropon
 Magdeburg, Germany

I have used gpart to partition a USB flash drive into FreeBSD boot partition, 
root partition and swap partition.

I ran newfs on the second (root) partition, even installed FreeBSD built from 
source, and made the flash drive bootable, both for amd64 and i386.

Does a USB flash drive also work as a giant floppy, no partitions?  Can you 
make a flash drive bootable when nonpartitioned and formatted that way?

Tom
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Format a USB flash drive using gpart

2012-07-07 Thread Warren Block

On Sat, 7 Jul 2012, Carmel wrote:


This is probably a dumb question, but does gpart even work on a USB
flash drive? I have not been able to figure out how to do it. I want to
erase the entire drive and format it for a FreeBSD UFS2 file system.


Yes, gpart will work with pretty much any storage device.

If you want the drive to be bootable, it needs boot blocks.  This is 
easier with GPT than MBR.  For an 8G drive:


# gpart create -s gpt da0
# gpart add -t freebsd-boot -s 512k da0
# gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da0
# gpart add -t freebsd-ufs -b 1M -s 7G da0
# gpart add -t freebsd-swap da0
# newfs -U /dev/da0p2
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org