DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 28th May 2017
daemonbak daemonbak is offline
Fdisk Soldier
 
Join Date: Feb 2015
Posts: 51
Question Sector Issues on Dump/Clone of Embedded FW

Hi all,

Have an issue here. I have 2 drives that are marketed as being the same size 32G. However, the source drive is slightly larger than the target drive for the dump.

Is there a way to make a change so that I can dump sd0 to sd1?

sd0 (system drive)
sd1 (target drive)

Process so far:

disklabel sd0 > /tmp/label.0
disklabel sd0 > /tmp/label.1
fdisk -i /dev/rsd1c
disklabel -Rr /dev/rsd1c /tmp/label.0 (ERROR - unknown option -r???)

removed -r from command
disklabel -R /dev/rsd1c /tmp/label.0 (ERROR - disklabel: partition k: partition extends past end of unit)

I took the c sector size from label.1 and replaced label.0 c sector size


disklabel -e sd0
Code:
/dev/rsd0c:
type: SCSI
disk: SCSI disk
label: Cruzer
duid: a32277e951b9534c
flags:
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 255
sectors/cylinder: 8160
cylinders: 7663
total sectors: 62530624
boundstart: 32
boundend: 62530080
drivedata: 0

16 partitions:
#                size           offset  fstype [fsize bsize  cpg]
  a:          4202368               32  4.2BSD   2048 16384    1 # /
  b:          8608800          4202400    swap                   # none
  c:         62530624                0  unused
  d:          4202400         12811200  4.2BSD   2048 16384    1 # /tmp
  e:          8396640         17013600  4.2BSD   2048 16384    1 # /var
  f:          8396640         25410240  4.2BSD   2048 16384    1 # /usr
  g:          2105280         33806880  4.2BSD   2048 16384    1 # /usr/X11R6
  h:          6299520         35912160  4.2BSD   2048 16384    1 # /usr/local
  i:          8396640         42211680  4.2BSD   2048 16384    1 # /usr/src
  j:          6299520         50608320  4.2BSD   2048 16384    1 # /usr/obj
  k:          5622240         56907840  4.2BSD   2048 16384    1 # /home

# Notes:
# Up to 16 partitions are valid, named from 'a' to 'p'.  Partition 'a' is
# your root filesystem, 'b' is your swap, and 'c' should cover your whole
# disk. Any other partition is free for any use.  'size' and 'offset' are
# in 512-byte blocks. fstype should be '4.2BSD', 'swap', or 'none' or some
/tmp/EdDk.akDxsfJLpVV: unmodified: line 1
disklabel -e sd1
Code:
# /dev/rsd1c:
type: SCSI
disk: SCSI disk
label: Cruzer
duid: d8fd3d7968f58007
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 3800
total sectors: 61056064
boundstart: 64
boundend: 61047000
drivedata: 0

16 partitions:
#                size           offset  fstype [fsize bsize  cpg]
  c:         61056064                0  4.2BSD   2048 16384    1

# Notes:
# Up to 16 partitions are valid, named from 'a' to 'p'.  Partition 'a' is
# your root filesystem, 'b' is your swap, and 'c' should cover your whole
# disk. Any other partition is free for any use.  'size' and 'offset' are
# in 512-byte blocks. fstype should be '4.2BSD', 'swap', or 'none' or some
# other values.  fsize/bsize/cpg should typically be '2048 16384 16' for a
# 4.2BSD filesystem (or '512 4096 16' except on alpha, sun4, ...)
Any solutions where I can dump this on the new drive as a emergency clone. I'd like to have a fallback that i can pop in when this drive dies.

Thanks
Reply With Quote
  #2   (View Single Post)  
Old 28th May 2017
daemonbak daemonbak is offline
Fdisk Soldier
 
Join Date: Feb 2015
Posts: 51
Default

I ended up using disklabel -E to manually partition the disk. All sizes are the same as the source drive... with a little stolen from home to adjust for the slightly smaller size.

I did notice that the offset default was 64 on the new drive, but the original source drive was 32 offset. I left it 64 to be safe.

Now what would be the best way to backup:
src drive > target drive?

Would this be dump | restore one partition at a time and then use dd for partition k (/home)

Thanks

New disklabel -e sd1
Code:
 /dev/rsd1c:
type: SCSI
disk: SCSI disk
label: Cruzer
duid: 4ba99503bda02123
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 3800
total sectors: 61056064
boundstart: 64
boundend: 61047000
drivedata: 0

16 partitions:
#                size           offset  fstype [fsize bsize  cpg]
  a:          4202368               64  4.2BSD   2048 16384    1
  b:          8608800          4202432    swap
  c:         61056064                0  unused
  d:          4202400         12811232  4.2BSD   2048 16384    1
  e:          8396640         17013632  4.2BSD   2048 16384    1
  f:          8396640         25410272  4.2BSD   2048 16384    1
  g:          2105280         33806912  4.2BSD   2048 16384    1
  h:          6299520         35912192  4.2BSD   2048 16384    1
  i:          8396640         42211712  4.2BSD   2048 16384    1
  j:          6299520         50608352  4.2BSD   2048 16384    1
  k:          4139104         56907872  4.2BSD   2048 16384    1

# Notes:
# Up to 16 partitions are valid, named from 'a' to 'p'.  Partition 'a' is
# your root filesystem, 'b' is your swap, and 'c' should cover your whole
# disk. Any other partition is free for any use.  'size' and 'offset' are
# in 512-byte blocks. fstype should be '4.2BSD', 'swap', or 'none' or some
# other values.  fsize/bsize/cpg should typically be '2048 16384 16' for a
# 4.2BSD filesystem (or '512 4096 16' except on alpha, sun4, ...)

Last edited by daemonbak; 28th May 2017 at 04:13 AM.
Reply With Quote
  #3   (View Single Post)  
Old 28th May 2017
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 305
Default

dump | restore works pretty well. That's my primary local backup mechanism. And I have had to do a recovery, both of individual files as well as whole partitions.

I would have taken the extra space out of /tmp or some other partition you wouldn't actually backup/restore. Pretty much anything outside of /home /etc /var or /root.
Reply With Quote
  #4   (View Single Post)  
Old 28th May 2017
daemonbak daemonbak is offline
Fdisk Soldier
 
Join Date: Feb 2015
Posts: 51
Default

I am doing the following now:

Code:
newfs /dev/sd1a
mount /dev/sd1a /mnt
(dump -0f - / )|(cd /mnt/; restore -rf -)
umount /mnt;

newfs /dev/sd1b

newfs /dev/sd1d
mount /dev/sd1d /mnt
(dump -0f - /tmp )|(cd /mnt/; restore -rf -)
umount /mnt;

newfs /dev/sd1e
mount /dev/sd1e /mnt
(dump -0f - /var )|(cd /mnt/; restore -rf -)
umount /mnt;

newfs /dev/sd1f
mount /dev/sd1f /mnt
(dump -0f - /usr )|(cd /mnt/; restore -rf -)
umount /mnt;

newfs /dev/sd1g
mount /dev/sd1g /mnt
(dump -0f - /usr/X11R6 )|(cd /mnt/; restore -rf -)
umount /mnt;

newfs /dev/sd1h
mount /dev/sd1h /mnt
(dump -0f - /usr/local )|(cd /mnt/; restore -rf -)
umount /mnt;

newfs /dev/sd1i
mount /dev/sd1i /mnt
(dump -0f - /usr/src )|(cd /mnt/; restore -rf -)
umount /mnt;

newfs /dev/sd1j
mount /dev/sd1j /mnt
(dump -0f - /usr/obj )|(cd /mnt/; restore -rf -)
umount /mnt;

newfs /dev/sd1k
mount /dev/sd1k /mnt
(dump -0f - /home )|(cd /mnt/; restore -rf -)
umount /mnt;
The issue I am having now is that / has the whole filesystem, /usr has all the data from partitions g + h + i + j as well as what it should. So dumping / dumps the entire disk to that partition, not how it is setup in the original disk and /usr partition has the following in it as well (it should have just f not the rest):

f: /usr
g: /usr/X11R6
h: /usr/local
i: /usr/src
j: /usr/obj
Reply With Quote
  #5   (View Single Post)  
Old 28th May 2017
TronDD TronDD is offline
Spam Deminer
 
Join Date: Sep 2014
Posts: 305
Default

Hmm... Are you sure it's the data of the sub-partitions and not just the mount points?
Reply With Quote
  #6   (View Single Post)  
Old 28th May 2017
daemonbak daemonbak is offline
Fdisk Soldier
 
Join Date: Feb 2015
Posts: 51
Default

ls -alR shows it is the contents as well. Solved by:
mount / to /mnt && d /mnt && rm -rf tmp var usr...

But there must be a more efficient way
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
5.8: fdisk(8) repaired to work on 4K sector disks again. Martillo OpenBSD Installation and Upgrading 2 4th October 2015 12:24 PM
Makefile for Vermaden's FreeBSD ZFS root install adapted for 4K sector disks J65nko Guides 6 5th August 2013 08:51 PM
Misc. BSD/UNIX BusyBox clone with a BSD license? comet--berkeley News 1 3rd February 2012 09:21 AM
Clonezilla Live clone system update J65nko News 0 28th September 2011 05:53 PM
how to remove boot sector viruses? CyberJet OpenBSD General 8 15th July 2011 07:50 PM


All times are GMT. The time now is 12:17 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick