Re: write all files in /mnt to usb using dd

2016-08-04 Thread Ax0n
I mis-understood your first post, Teng. The .iso image confused me and I
thought you were trying to write to optical media.

It sounds like you needed to simply mount the USB removable mass storage to
/mnt.  Oddly enough, I can't find a directly relevant entry for this in the
OpenBSD FAQ to link to, though it seems like a common-enough task. I'll
outline some simple steps for you (and maybe submit a diff for the
Multimedia FAQ with some more refinement).

Typically, /mnt doesn't have any files in it before you mount it. You
should move them somewhere else to avoid confusion.

Use disklabel(8) to determine the partition you want to mount. Many
pre-formatted USB drives have a MSDOS/FAT filesystem on partition i. For
example, on my laptop, the USB stick I inserted showed up as sd2, since sd1
is taken by the built-in media card reader. disklabel shows two entries (c
is always a meta-partition that means "whole disk") and the one I want to
mount is sd2i.

[axon@zodiac ~]$ doas disklabel sd2
# /dev/rsd2c:
type: SCSI
disk: SCSI disk
label: Windrunner
duid: 
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 7
total sectors: 118672
boundstart: 0
boundend: 118672
drivedata: 0

16 partitions:
#size   offset  fstype [fsize bsize  cpg]
  c:   1186720  unused
  i:   118543   32   MSDOS

[axon@zodiac ~]$ doas mount /dev/sd2i /mnt

As you can see below, /mnt is on /dev/sd2i and ready to use.
[axon@zodiac ~]$ df -h
Filesystem SizeUsed   Avail Capacity  Mounted on
/dev/sd0a  8.2G7.3G533M93%/
/dev/sd0l 59.6G4.1G   52.5G 7%/home
/dev/sd2i 57.8M   30.4M   27.4M53%/mnt
[axon@zodiac ~]$

Any files you copy to /mnt ought to show up on the removable media now.
Remember to umount /mnt when you're done. As Ted stated, you may also wish
to use tar to archive files to external media instead.

On Thu, Aug 4, 2016 at 8:21 AM, Teng Zhang  wrote:

> excellent idea!
> i bought two DVD+R discs,and storage 01.iso using the way you told me
> (the FAQ), it works fine. Thank you very much for your advice.
> And at the same time,i realize that the DVD+RW actually can replace the
> USB at
> least in terms of storaging  files(because they can both be written a
> thousound
> times)
>
>
> On 08/04/16 10:15, Noah wrote:
>
> If you look carefully at the man page for dd(1), you'll see that you can
> use it to write an image file directly to the block device. This is good
> for writing the contents of installXX.fs to a USB stick, or for making
> images of removable media. It's not the recommended way to burn an ISO to
> optical media, though.
>
> The steps you're looking for are outlined nicely in the FAQ:
> http://www.openbsd.org/faq/faq13.html#burnCD
> The man pages for mkhybrid(8) and cdio(1) are also worth a look.
>
> To directly answer your question, the steps you likely need to take
> (assuming your burner is cd1... you didn't paste your entire dmesg, so I
> can't tell what we're dealing with here):
>
> mkhybrid -R -o 01.iso /mnt
> cdio -f cd1c tao 01.iso
>
> On Wed, Aug 3, 2016 at 8:43 PM, Teng Zhang  wrote:
>
>> hi, i want to write all files in /mnt to usb,so i issued the command:
>>
>> doas dd if=/mnt of=/dev/rsd1c bs=5M
>>
>> but it failed. I'm not pretty understand the way to operate dd, so
>> could you please tell me how can i operate it to write the files to
>> usb?
>> Some information about my system:
>>
>> the files in /mnt is created like this:
>>
>> $ doas vnconfig vnd0 01.iso
>> $ doas mount /dev/vnd0c /mnt
>>
>> $ uname -a
>> OpenBSD zhangteng.my.domain 5.9 GENERIC.MP#1888 amd64
>>
>> $ mount
>> /dev/sd0a on / type ffs (local)
>> /dev/sd0m on /home type ffs (local, nodev, nosuid)
>> /dev/sd0d on /tmp type ffs (local, nodev, nosuid)
>> /dev/sd0f on /usr type ffs (local, nodev)
>> /dev/sd0g on /usr/X11R6 type ffs (local, nodev)
>> /dev/sd0h on /usr/local type ffs (local, nodev)
>> /dev/sd0l on /usr/obj type ffs (local, nodev, nosuid)
>> /dev/sd0k on /usr/src type ffs (local, nodev, nosuid)
>> /dev/sd0e on /var type ffs (local, nodev, nosuid)
>> /dev/vnd0c on /mnt type cd9660 (local, read-only)
>>
>> dmesg:
>> umass0 at uhub2 port 1 configuration 1 interface 0 "SanDisk Cruzer Edge"
>> rev 2.10/1.00 addr 3
>> umass0: using SCSI over Bulk-Only
>> scsibus2 at umass0: 2 targets, initiator 0
>> sd1 at scsibus2 targ 1 lun 0:  SCSI4 0/direct
>> removable serial.0781556b970715105252
>> sd1: 7632MB, 512 bytes/sector, 15630336 sectors



Re: write all files in /mnt to usb using dd

2016-08-04 Thread Raf Czlonka
Hi,

What are you trying to do?

If you're after files which are on the ISO image, then cp(1) will
do just fine - simply mount the USB disk and copy the files.

Unless of course, you're trying to create a bootable USB stick out
of a bootable ISO image - neither cp(1) nor tar(1) will do the job
in this case and you will need to use dd(1).

Again, if this is indeed the case, *and* you are trying to create
a bootable OpenBSD USB install medium, ISO won't work in this case
- you'll need to use either the minirootXX.fs or installXX.fs images[0]

Regards,

Raf

[0] http://www.openbsd.org/faq/faq4.html#MkInsMedia

On Thu, Aug 04, 2016 at 02:43:20AM BST, Teng Zhang wrote:
> hi, i want to write all files in /mnt to usb,so i issued the command:
> 
> doas dd if=/mnt of=/dev/rsd1c bs=5M
> 
> but it failed. I'm not pretty understand the way to operate dd, so
> could you please tell me how can i operate it to write the files to
> usb?
> Some information about my system:
> 
> the files in /mnt is created like this:
> 
> $ doas vnconfig vnd0 01.iso
> $ doas mount /dev/vnd0c /mnt
> 
> $ uname -a
> OpenBSD zhangteng.my.domain 5.9 GENERIC.MP#1888 amd64
> 
> $ mount
> /dev/sd0a on / type ffs (local)
> /dev/sd0m on /home type ffs (local, nodev, nosuid)
> /dev/sd0d on /tmp type ffs (local, nodev, nosuid)
> /dev/sd0f on /usr type ffs (local, nodev)
> /dev/sd0g on /usr/X11R6 type ffs (local, nodev)
> /dev/sd0h on /usr/local type ffs (local, nodev)
> /dev/sd0l on /usr/obj type ffs (local, nodev, nosuid)
> /dev/sd0k on /usr/src type ffs (local, nodev, nosuid)
> /dev/sd0e on /var type ffs (local, nodev, nosuid)
> /dev/vnd0c on /mnt type cd9660 (local, read-only)
> 
> dmesg:
> umass0 at uhub2 port 1 configuration 1 interface 0 "SanDisk Cruzer Edge" rev
> 2.10/1.00 addr 3
> umass0: using SCSI over Bulk-Only
> scsibus2 at umass0: 2 targets, initiator 0
> sd1 at scsibus2 targ 1 lun 0:  SCSI4 0/direct
> removable serial.0781556b970715105252
> sd1: 7632MB, 512 bytes/sector, 15630336 sectors



Re: write all files in /mnt to usb using dd

2016-08-03 Thread Ted Unangst
Teng Zhang wrote:
> hi, i want to write all files in /mnt to usb,so i issued the command:
> 
>  doas dd if=/mnt of=/dev/rsd1c bs=5M
> 
> but it failed. I'm not pretty understand the way to operate dd, so
> could you please tell me how can i operate it to write the files to
> usb?

The tool you should be using is tar.



write all files in /mnt to usb using dd

2016-08-03 Thread Teng Zhang

hi, i want to write all files in /mnt to usb,so i issued the command:

doas dd if=/mnt of=/dev/rsd1c bs=5M

but it failed. I'm not pretty understand the way to operate dd, so
could you please tell me how can i operate it to write the files to
usb?
Some information about my system:

the files in /mnt is created like this:

$ doas vnconfig vnd0 01.iso
$ doas mount /dev/vnd0c /mnt

$ uname -a
OpenBSD zhangteng.my.domain 5.9 GENERIC.MP#1888 amd64

$ mount
/dev/sd0a on / type ffs (local)
/dev/sd0m on /home type ffs (local, nodev, nosuid)
/dev/sd0d on /tmp type ffs (local, nodev, nosuid)
/dev/sd0f on /usr type ffs (local, nodev)
/dev/sd0g on /usr/X11R6 type ffs (local, nodev)
/dev/sd0h on /usr/local type ffs (local, nodev)
/dev/sd0l on /usr/obj type ffs (local, nodev, nosuid)
/dev/sd0k on /usr/src type ffs (local, nodev, nosuid)
/dev/sd0e on /var type ffs (local, nodev, nosuid)
/dev/vnd0c on /mnt type cd9660 (local, read-only)

dmesg:
umass0 at uhub2 port 1 configuration 1 interface 0 "SanDisk Cruzer Edge" 
rev 2.10/1.00 addr 3

umass0: using SCSI over Bulk-Only
scsibus2 at umass0: 2 targets, initiator 0
sd1 at scsibus2 targ 1 lun 0:  SCSI4 
0/direct removable serial.0781556b970715105252

sd1: 7632MB, 512 bytes/sector, 15630336 sectors