|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
||||
DD command on OpenBsd
I have used the dd command in the past, but it was on linux system, and am having trouble using it on OpenBsd.
Code:
# dd if=/dev/sda of=/dev/sdc bs=8M; sync I am using another USB drive, with OpenBsd on it, it is bootable and works fine, Actually I made it some time ago, but using a portable usb drive, with Linux on it, and I copied my OpenBsd HD, to the device, using the above command with no problem. The devices all show ok when I use: Code:
sysctl hw.disknames Thanks
__________________
My best friends are parrots |
|
|||
sda, sdb, etc. are Linuxisms. That's not how the BSDs identify their disks.
On OpenBSD, they would be sd0, sd1, or something like that. For example, on my machine, Code:
$ sysctl hw.disknames Code:
hw.disknames=sd0:585806def6f81d18 |
|
||||
Ok, yes I know that, my fault though I showed what I used when I had run it from a Linux system.
When I run the command using OpenBsd, it is : Code:
# dd if=/dev/sd0 of=/dev/sd2 bs=8M; sync
__________________
My best friends are parrots |
|
||||
Thanks, now that makes sense and I will give it a try .
===edited==== Code:
# dd if=/dev/rsd0c of=/dev/rsd2c bs=8M; sync
__________________
My best friends are parrots Last edited by PapaParrot; 7th November 2018 at 12:43 AM. |
|
||||
Thanks,
It did finish, but for some reason the system on USB device does not boot properly. It boots , but fails, saying to run fsck_ffs manually . I am looking at the manual on that just now: Code:
SYNOPSIS fsck_ffs [-fnpy] [-b block#] [-c level] [-m mode] filesystem In any event it (the USB drive), does mount ok, and for example, I mounted the sd1k, which is my home directory , everything is there as it should be,... so any way, I am working on it now. Thanks
__________________
My best friends are parrots Last edited by PapaParrot; 7th November 2018 at 12:32 PM. |
|
||||
I will assume you were copying sd0 partitions while they were mounted and in use. If so, I will assume that your /var partition had files open for writing, and an automatic "preen" of the open filesystem failed, requiring manual fsck(8).
To avoid this in the future, either boot into single-user mode (-s), which starts with only the root partition mounted, and mounted read-only. You could also boot the RAMDISK kernel, which has a small in-memory filesystem which I believe includes the dd(1) utility. |
|
||||
No, actually they were not mounted, I used another usb drive to boot with and run the command, so that sd0, and sd2 were not mounted. The drive I booted with was sd1, all 3 did show when I used the hw.disknames command.
__________________
My best friends are parrots |
|
||||
Here's some background.
I will revise my assumption. Your sd0 drive is either actively in use or was previously in use without a clean unmount of all of its partitions. |
|
||||
And I'll stick with my assumption of likely active use. By default, OpenBSD uses DUIDs in fstab(5). You can boot your kernel from sd1 and still mount all partitions from sd0, depending on the contents of the fstab(5) and the DUIDs of the disk drives involved. df(1) can tell you which device numbers have partitions mounted.
|
|
||||
Ok, thanks again for all the time on this, So, let me see if I understand correctly,
Quote:
It is kind of strange to me, because I have done this several times in the past, and never encountered this type of problem, also , now I am running into a new problem, but different topic all together, I will post about that separate, though. But in a nut shell, several things are going on that I have not seen before. I plan to upgrade the system to 6.4, but am now thinking maybe better to do a fresh install. I wanted to make a copy of my current system, that I would have on the usb drive, in case something goes wrong. In any event, the one portable USB drive, has OpenBsd 6.3 on it, and it boots fine, but it is a little old, but has everything that is essential to me (important data), ... When I made that drive, I used the dd command, same as above, and did not encounter this problem. I must say, I had used a Linux live device, for that, but either way I am getting the same results now, I have tried 3 times, and get the same, a device that does not boot properly, all though all the data appears to have been copied correctly. thanks again,
__________________
My best friends are parrots |
|
||||
@Garry, if you want to backup your system check out the /altroot facility:
https://www.openbsd.org/faq/faq14.html#altroot You will need to configure the bootloader for the backup disk though, apparently.
__________________
Destruam et ædificabo |
|
||||
Thanks, H-O-A-S, I am looking at that right now, but will need to read it more carefully later.
Quote:
Code:
shutdown -p now Not related directly, but there is a lot going lately in my personal life, activity and it is making it extra difficult to concentrate, etc.
__________________
My best friends are parrots |
|
||||
Here is what it says when I run the 'fsck_ffs' command , on the device, it is not mounted at this time:
Code:
garry# fsck_ffs -fyp /dev/rsd2c /dev/rsd2c: BAD SUPER BLOCK: MAGIC NUMBER WRONG /dev/rsd2c: UNEXPECTED INCONSISTENCY; RUN fsck_ffs MANUALLY. garry# fsck_ffs /dev/rsd2c ** /dev/rsd2c BAD SUPER BLOCK: MAGIC NUMBER WRONG /dev/rsd2c: NOT LABELED AS A BSD FILE SYSTEM (unused)
__________________
My best friends are parrots |
|
|||
I mean, fsck(8) and its ilk don't run on raw devices. You need to specify a file system on the sd2 (in your example above) device. Try maybe:
Code:
# fsck -fyp /dev/sd2a |
|
||||
Garry, it may help to consider that storage devices are a collection of blocks - "sectors" - each containing collections of ones and zeros. For mass storage devices such as disk drives (and USB sticks) the leading sectors will contain partitioning information, and may also contain boot programs.
Last edited by jggimi; 8th November 2018 at 04:52 PM. Reason: found a typo, added some minor clarity |
|
||||
Thanks again, every one, learned a lot here. It is working now.
__________________
My best friends are parrots |
|
||||
Glad you've got it working!
By the way there are storage devices that do not use partitioning, such as floppy disks, magnetic tapes, and optical media. But most everything else does. Yes, you can provision a disk drive without a disklabel, or an MBR, or any other partitioning schema. But this is not an operational best practice. If the leading sectors of a device are not recognizable, it is possible to accidentally overwrite its contents. This is why the GPT standard includes a "protective MBR" in sector #0, so that a system which does not recognize the GPT might recognize the MBR, and the system (or its human) might stop themselves from scribbling on it. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenBSD find command -- exclude dot directory | gustaf | OpenBSD General | 2 | 26th June 2017 05:12 AM |
trying to understand command | amrogers3 | OpenBSD General | 9 | 3rd November 2011 04:38 AM |
pf block command help | newbsdied | OpenBSD Security | 1 | 7th November 2010 12:50 AM |
How to expand who command? | guitarscn | FreeBSD General | 1 | 27th August 2010 11:53 PM |
How to modify the ls command? | bsdnewbie999 | OpenBSD General | 9 | 16th May 2009 08:20 AM |