2013年6月27日木曜日

openbsd backup using dump at single user mode V2

Summary:
boot -s
fsck -p
mount -a
dump -0af - /dev/wd0e | gzip > /mnt/openbsd_wd0e.gz
dump -0af - /dev/wd0a | gzip > /mnt/openbsd_wd0a.gz




SH IPL+g version 0.9, Copyright (C) 2000 Free Software Foundation, Inc.

This software comes with ABSOLUTELY NO WARRANTY; for details type `w'.
This is free software, and you are welcome to redistribute it under
certain conditions; type `l' for details.

2002/09/09 Making.  2004/09/08 I-O DATA NSU Update.
266:133:33 on base clock 22.22MHz and SDRAM 4 burst. CF boot.

PCIC initialization done.
MASTER:48bit LBA mode non support
Disk drive detected: TRANSCEND 20070831 0           00116424
LBA: 003BBD40
DiskSize: 2004516864Byte
PIO MODE1
Set Transfer Mode result: 50
> b
Set Transfer Mode result: 50
Initialize Device Parameters result: 50
IDLE result: 50

OpenBSD MBR

OpenBSD/landisk Primary Bootstrap
>> OpenBSD/landisk BOOT 1.01
boot> boot -s
booting cf:/bsd: 2590252+425140 [72+147792+135277]=0x3256d4
[ using 283636 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
        The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2009 OpenBSD. All rights reserved.  http://www.OpenBSD.org

OpenBSD 4.5 (GENERIC) #213: Tue Mar  3 10:20:57 MST 2009
    deraadt@landisk:/usr/src/sys/arch/landisk/compile/GENERIC
I-O DATA USL-5P
real mem = 67108864 (64MB)
avail mem = 62455808 (59MB)
mainbus0 at root
cpu0 at mainbus0: HITACHI SH4 266.666 MHz PCLOCK 33.333 MHz
cpu0: 16KB/32B 2-way associative I-cache, 32KB/32B 2-way associative D-cache
shb0 at mainbus0
scif0 at shb0
scif0: console
rsclock0 at shb0: RS5C313 real time clock
shpcic0 at mainbus0: HITACHI SH7751R
pci0 at shpcic0
re0 at pci0 dev 0 function 0 "Realtek 8139" rev 0x20: RTL8139C+ (0x7480), irq 5,
 address 00:a0:b0:6c:e7:0c
rlphy0 at re0 phy 0: RTL internal PHY
ohci0 at pci0 dev 2 function 0 "NEC USB" rev 0x43: irq 7, version 1.0
ohci1 at pci0 dev 2 function 1 "NEC USB" rev 0x43: irq 8, version 1.0
ehci0 at pci0 dev 2 function 2 "NEC USB" rev 0x04: irq 5
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "NEC EHCI root hub" rev 2.00/1.00 addr 1
usb1 at ohci0: USB revision 1.0
uhub1 at usb1 "NEC OHCI root hub" rev 1.00/1.00 addr 1
usb2 at ohci1: USB revision 1.0
uhub2 at usb2 "NEC OHCI root hub" rev 1.00/1.00 addr 1
obio0 at mainbus0
wdc0 at obio0 port 0x14000000-0x1400000f irq 10
wd0 at wdc0 channel 0 drive 0: 
wd0: 1-sector PIO, LBA, 1911MB, 3915072 sectors
wd0(wdc0:0:0): using BIOS timings
power0 at obio0 irq 11
umass0 at uhub0 port 1 configuration 1 interface 0 "SIREN UM100-2GT" rev 2.00/1.
10 addr 2
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0:  SCSI0 0/direct removable
sd0: 1995MB, 512 bytes/sec, 4086784 sec total
softraid0 at root
root on wd0a swap on wd0b dump on wd0b
Enter pathname of shell or RETURN for sh:
Terminal type? vt100
# fsck -p
/dev/rwd0a: file system is clean; not checking
/dev/rwd0e: file system is clean; not checking
# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
root_device    1.5G    465M    970M    32%    /
# mount -a
# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/wd0a      1.5G    465M    970M    32%    /
/dev/wd0e      242M    4.4M    226M     2%    /var
# mount /dev/sd0i /mnt
# which gzip
/usr/bin/gzip
# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/wd0a      1.5G    465M    970M    32%    /
/dev/wd0e      242M    4.4M    226M     2%    /var
/dev/sd0i      1.8G    871M    970M    47%    /mnt
# dump -0af - /dev/wd0e | gzip > /mnt/openbsd_wd0e.gz
  DUMP: Date of this level 0 dump: Wed Nov  3 21:23:42 2010
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rwd0e (/var) to standard output
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 4544 tape blocks.
  DUMP: Volume 1 started at: Wed Nov  3 21:23:44 2010
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: 4926 tape blocks
  DUMP: Date of this level 0 dump: Wed Nov  3 21:23:42 2010
  DUMP: Volume 1 completed at: Wed Nov  3 21:23:52 2010
  DUMP: Volume 1 took 0:00:08
  DUMP: Volume 1 transfer rate: 615 KB/s
  DUMP: Date this dump completed:  Wed Nov  3 21:23:52 2010
  DUMP: Average transfer rate: 615 KB/s
  DUMP: DUMP IS DONE
# dump -0af - /dev/wd0a | gzip > /mnt/openbsd_wd0a.gz
  DUMP: Date of this level 0 dump: Wed Nov  3 21:24:15 2010
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rwd0a (/) to standard output
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 477764 tape blocks.
  DUMP: Volume 1 started at: Wed Nov  3 21:24:23 2010
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: 26.88% done, finished in 0:13
  DUMP: 51.01% done, finished in 0:09
  DUMP: 77.16% done, finished in 0:04
  DUMP: 486282 tape blocks
  DUMP: Date of this level 0 dump: Wed Nov  3 21:24:15 2010
  DUMP: Volume 1 completed at: Wed Nov  3 21:43:08 2010
  DUMP: Volume 1 took 0:18:45
  DUMP: Volume 1 transfer rate: 432 KB/s
  DUMP: Date this dump completed:  Wed Nov  3 21:43:08 2010
  DUMP: Average transfer rate: 432 KB/s
  DUMP: DUMP IS DONE
# ls -l /mnt
[snip]
-rwxr-xr-x  1 root  wheel  169762499 Nov  3 21:43 openbsd_wd0a.gz
-rwxr-xr-x  1 root  wheel    1403468 Nov  3 21:23 openbsd_wd0e.gz
# umount /mnt
# shutdown -hp now
Shutdown NOW!
shutdown: [pid 20342]
# Nov  3 22:10:43 shutdown: halt by root:

System shutdown time has arrived
Nov  3 22:10:47 init: kernel security level changed from 0 to 1
/etc/rc.shutdown in progress...
/etc/rc.shutdown complete.
syncing disks... done



END

2013年6月21日金曜日

openbsd on usl-5p (initial Installation)

(1) Follow the installation instruction
Refer to ftp://ftp.openbsd.org/pub/OpenBSD/snapshots/landisk/INSTALL.landisk

Here is the installation log

Notes:
(a) I was installing from version 4.6.
(b) dd the miniroot4.6.ff to the same CF that you will later install into.

(2) create user account and disable root ssh
Refer to http://www.openbsd101.com/tipstricks.html


# useradd -c "nobita kun" -s /bin/ksh -g users -d /home/nobita -m nobita
# usermod -G wheel nobita


(3) Backup OS using dump and ssh


root@:~# df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/wd0a 2.9G 444M 2.4G 15% /
/dev/wd0e 281M 2.4M 265M 1% /var

root@:~# dump -0auf - /dev/wd0e | ssh xxx@192.168.1.109 "cat > /virtualbox/usl5p_var.dump"
DUMP: Date of this level 0 dump: Sun Jul 12 16:13:29 2009
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rwd0e (/var) to standard output
Password: DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 2512 tape blocks.
DUMP: Volume 1 started at: Sun Jul 12 16:13:32 2009
DUMP: dumping (Pass III) [directories]

DUMP: dumping (Pass IV) [regular files]
DUMP: 2779 tape blocks
DUMP: Date of this level 0 dump: Sun Jul 12 16:13:29 2009
DUMP: Volume 1 completed at: Sun Jul 12 16:13:41 2009
DUMP: Volume 1 took 0:00:09
DUMP: Volume 1 transfer rate: 308 KB/s
DUMP: Date this dump completed: Sun Jul 12 16:13:41 2009
DUMP: Average transfer rate: 308 KB/s
DUMP: level 0 dump on Sun Jul 12 16:13:29 2009
DUMP: DUMP IS DONE
root@:~# dump -0auf - /dev/wd0a | ssh xxx@192.168.1.109 "cat > /virtualbox/usl5p_root.dump"
DUMP: Date of this level 0 dump: Sun Jul 12 16:14:35 2009
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rwd0a (/) to standard output
DUMP: mapping (Pass I) [regular files]
Password:
DUMP: mapping (Pass II) [directories]
DUMP: estimated 456273 tape blocks.
DUMP: Volume 1 started at: Sun Jul 12 16:14:50 2009
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: 57.15% done, finished in 0:03
DUMP: 464373 tape blocks
DUMP: Date of this level 0 dump: Sun Jul 12 16:14:35 2009
DUMP: Volume 1 completed at: Sun Jul 12 16:23:45 2009
DUMP: Volume 1 took 0:08:55
DUMP: Volume 1 transfer rate: 867 KB/s
DUMP: Date this dump completed: Sun Jul 12 16:23:45 2009
DUMP: Average transfer rate: 867 KB/s
DUMP: level 0 dump on Sun Jul 12 16:14:35 2009
DUMP: DUMP IS DONE



Refer to Restore on how to restore from above backup

(4) mounting USB storage
Refer to http://www.openbsd101.com/tipstricks.html

End


;-)

Raspberry Pi with USB2Serial

Problem: Everytime when i connect a USB2Serial converter (PL2303) to my RaspberryPi it will crash the RaspberryPi.
Workaround: i had to plug in the USB2Serial converter first before powering up RaspberryPi.
[    3.212148] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
[    3.333458] usb 1-1.2: New USB device found, idVendor=07aa, idProduct=002a
[    3.360639] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    3.670429] udevd[142]: starting version 175
[    4.802936] Registered led device: led0
[    4.909087] usbcore: registered new interface driver usbserial
[    5.020630] usbcore: registered new interface driver usbserial_generic
[    5.451993] usbserial: USB Serial Driver core
[    5.606954] usbcore: registered new interface driver pl2303
[    5.872021] pl2303 1-1.2:1.0: pl2303 converter detected
[    5.957278] usb 1-1.2: pl2303 converter now attached to ttyUSB0

(1) Setting up minicom
(1.1) Disable console ttyAMA0
(1.2) Disable boot info
(1.3) Reboot for changes to take effect
(1.4) Install minicom