NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: New hard disk, copying data

Hi all

(I read also all other useful hints. I think tar or dump/restore will be best for copying, but I have problems before)
Andrew Smallshaw wrote:
On Thu, May 23, 2013 at 05:07:19PM +0200, Riccardo Mottola wrote:
1) attach the hard disk in an external USB enclosure
2) Partition int
3) Copy the data (how? using tar/untar perhaps?)
4) write the MBR (but how, from the command line? and I don't need
the boot selection anymore, just flat into NetBSD)
Briefly, fdisk then disklabel then newfs the new root partition.
No need for tar etc if you're mounting it in a USB enclosure, a
simple cp -Rp will do the trick.  Making the disk bootable is
slightly more tricky, you need to install the MBR and then the
primary and secondary boot code (man installboot).

I have troubles partitioning the disk! After so many years with NetBSD I feel like a beginner.

I do not need to copy Windows stuff, I will throw away the windows partition to fit on the smaller 32GB (30G actual, as you will see) SSD disk.

I did run fdisk and disklabel and got to this point:
bash-4.2# fdisk /dev/sd0
fdisk: Cannot determine the number of heads
Disk: /dev/sd0d
NetBSD disklabel disk geometry:
cylinders: 30534, heads: 64, sectors/track: 32 (2048 sectors/cylinder)
total sectors: 62533632, bytes/sector: 512

BIOS disk geometry:
cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 62533632

Partitions aligned to 2048 sector boundaries, offset 63

Partition table:
0: NetBSD (sysid 169)
    start 63, size 62533569 (30534 MB, Cyls 0-3892/137/21)
        PBR is not bootable: All bytes are identical (0x00)
Bootselector enabled, timeout 0 seconds.
No active partition.

I then did several attempts with disklabel and nefs, quite corrputing stuff! Right now I have:
4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:  60416000        63     4.2BSD      0     0     0  # (Cyl. 0*-  29500*)
b: 2117569 60416063 swap # (Cyl. 29500*- 30533)
 c:  62533569        63     unused      0     0        # (Cyl. 0*-  30533)
 d:  62533632         0     unused      0     0        # (Cyl. 0 -  30533)

please note that partition a has an offset of 63. I did that by setting the start of 63 sectors. If I do not do thi,s after I run a newfs, the disklabel completely corrupts! It is not being very user-friendly here. Sine I have seen that my current internal IDE disk has too an offset of 63, I inserted it.
I then did run a newfs on rsd0a.
But a subsequent fsck on the new partition fails:
bash-4.2# fsck /dev/sd0a
** /dev/rsd0a
Invalid signature in boot block: 0000

This can't be good, can't it? Perhaps the fsize/bsize being 0 are the problem?
Or the PBR being 0? How do I fix that?
If I manyally need to enter the offset of the first partition, disklabel is really trying to be an expert tool ;)


By reference, the current ide disk has:
16 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:  81668160        63     4.2BSD   2048 16384     0  # (Cyl. 0*-  81020*)
b: 263277 81668223 swap # (Cyl. 81020*- 81281*)
 c:  81931437        63     unused      0     0        # (Cyl. 0*-  81281*)
 d: 117210240         0     unused      0     0        # (Cyl. 0 - 116279)
f: 35278740 81931500 MSDOS # (Cyl. 81281*- 116279)


Home | Main Index | Thread Index | Old Index