hi all

Clone from 128GB nvme to 256GB nvme with dd and then clean up

with nvme , boot bsd.rd and the it doesn't work at fdisk -e sd1

In my case , I always create a swap partition first ,
then /tmp ,
and then create /,
so there is an empty part after /, so I can expand it.







1) boot PC wiith USB HDD (openbsd is installed)


2)256GB nvme is sd1

namely
# disklabel -E sd1

Label editor (enter '?' for help at any prompt)
sd1> p
OpenBSD area: 133120-234441613; size: 234308493; free: 16
#                size           offset  fstype [fsize bsize   cpg]
  a:        200737248         33704352  4.2BSD   2048 16384 12959
  b:         16783325           133120    swap
  c:        468862128                0  unused
  d:         16787904         16916448  4.2BSD   2048 16384 12960
  i:           131072             2048   MSDOS
sd1> q
No label changes.


3) fist 256GB nvme is rysnched  to 320GB HDD (this is sd3)
# rsync -avHx /m1a/  /m3a/


4)now
# sysctl hw.disknames    is

hw.disknames=sd0:52d710d07bebda26,cd0:,sd1:88288c44497d7022,sd2:3d4598786292b50c,sd3:d79c02d2057adcb1




5)# umount /m1a



6)
# fdisk -e sd1
Enter 'help' for information

sd1: 1> p
Disk: sd1       Usable LBA: 34 to 468862094 [468862128 Sectors]
GUID: 64993e58-e41f-4644-bd81-ecc381f110c5
   #: type                                 [       start:         size ]
      guid                                 name
------------------------------------------------------------------------
   0: EFI Sys                              [        2048:       131072 ]
      b7918f5f-d85b-4325-afc2-5d77e9ac43f1 EFI system partition

   3: OpenBSD                              [      133120:    234308493 ]
      e25cfd82-c3c3-4335-a154-19d42078cef7 OpenBSD disklabel


expand 3 erea
sd1: 1> edit 3
   #: type                                 [       start:         size ]
------------------------------------------------------------------------
   3: OpenBSD                              [      133120:    234308493 ]
Partition id ('0' to disable) [01 - FF, <uuid>]: [A6] (? for help)
Partition offset [34 - 468862094]: [133120]
Partition size [1 - 468728975]: [468728975] <ーーーto the end point
Partition name: [OpenBSD disklabel]

sd1*: 1> p
Disk: sd1       Usable LBA: 34 to 468862094 [468862128 Sectors]
GUID: 64993e58-e41f-4644-bd81-ecc381f110c5
   #: type                                 [       start:         size ]
      guid                                 name
------------------------------------------------------------------------
   0: EFI Sys                              [        2048:       131072 ]
      b7918f5f-d85b-4325-afc2-5d77e9ac43f1 EFI system partition

   3: OpenBSD                              [      133120:    468728975 ]
<ーーーenlarged
sd1*: 1> w
Writing GPT.
sd1: 1> q


7)
# disklabel -E sd1
Label editor (enter '?' for help at any prompt)
sd1> p
OpenBSD area: 133120-234441613; size: 234308493; free: 16
#                size           offset  fstype [fsize bsize   cpg]
  a:        200737248         33704352  4.2BSD   2048 16384 12959
  b:         16783325           133120    swap
  c:        468862128                0  unused
  d:         16787904         16916448  4.2BSD   2048 16384 12960
  i:           131072             2048   MSDOS


sd1> b <----------------------------------------important point
Starting sector: [133120]
Size ('*' for entire disk): [234308493] * <-----point

sd1*> p
OpenBSD area: 133120-468862128; size: 468729008; free: 234420531
#                size           offset  fstype [fsize bsize   cpg]
  a:        200737248         33704352  4.2BSD   2048 16384 12959
  b:         16783325           133120    swap
  c:        468862128                0  unused
  d:         16787904         16916448  4.2BSD   2048 16384 12960
  i:           131072             2048   MSDOS
sd1*> d a
sd1*> a a
offset: [33704352]
size: [435157776]
FS type: [4.2BSD]
sd1*> p
OpenBSD area: 133120-468862128; size: 468729008; free: 83
#                size           offset  fstype [fsize bsize   cpg]
  a:        435157696         33704384  4.2BSD   4096 32768     1
<---サイズ増えてる
  b:         16783325           133120    swap
  c:        468862128                0  unused
  d:         16787904         16916448  4.2BSD   2048 16384 12960
  i:           131072             2048   MSDOS

sd1*> w
sd1> q
No label changes.


8)# newfs sd1a

9)# mount /dev/sd1a  /m1a

# df
Filesystem  512-blocks      Used     Avail Capacity  Mounted on
/dev/sd2a    135124276   9999640 118368424     8%    /
/dev/sd3a    615302152  24245752 560291296     4%    /m3a
/dev/sd1a    428308848         8 406893400     0%    /m1a

# rsync -avHx /m3a/  /m1a/



10)
# sysctl hw.disknames

hw.disknames=sd0:52d710d07bebda26,cd0:,sd1:88288c44497d7022,sd2:3d4598786292b50c,sd3:d79c02d2057adcb1


# cat /m1a/etc/fstab

88288c44497d7022.b none swap sw
88288c44497d7022.a / ffs rw,wxallowed 1 1
88288c44497d7022.d /tmp ffs rw,nodev,nosuid 1 2


OK!


## Oh Shindo


regards

-- 

from tuyoshi takesima

Reply via email to