|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
create and mount partition on image file
Hi,
I am trying to create raw image for my cloud environment , I can create image with single / partition but I want to create almost 6 GB image with /, /usr and /home partition .. Since , I want to have default layout so I used (disklabel -A) to create automatic layout and it shows / , /usr and /home by default. (Step 4) Now I can mount whole disk (Step 6) but how can I access/mount other partitions (/usr/, /home) in order to install some packages in /usr and set mount parameters (wxallow) in image. my ultimate goal is to create image with multiple partition layout (/, /usr,/home , /tmp etc). and /usr has wxallowe mount flag in image. Steps : 1) #dd if=/dev/null of=/tmp/img.raw bs=1M seek=6*1024 2) # vnconfig vnd0 /tmp/img.raw 3) #fdisk -iy /dev/rvnd0c Writing MBR at offset 0. 4) # disklabel -A vnd0c # /dev/rvnd0c: type: vnd disk: vnd device label: fictitious duid: 0000000000000000 flags: bytes/sector: 512 sectors/track: 100 tracks/cylinder: 1 sectors/cylinder: 100 cylinders: 125829 total sectors: 12582912 boundstart: 128 boundend: 12582900 drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg] a: 2018080 128 4.2BSD 2048 16384 1 # / b: 524288 2018208 swap c: 12582912 0 unused d: 6291456 2542496 4.2BSD 2048 16384 1 # /usr e: 3748928 8833952 4.2BSD 2048 16384 1 # /home # 5) # newfs vnd0c /dev/rvnd0c: 6144.0MB in 12582912 sectors of 512 bytes 31 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each super-block backups (for fsck -b #) at: 160, 414880, 829600, 1244320, 1659040, 2073760, 2488480, 2903200, 3317920, 3732640, 4147360, 4562080, 4976800, 5391520, 5806240, 6220960, 6635680, 7050400, 7465120, 7879840, 8294560, 8709280, 9124000, 9538720, 9953440, 10368160, 10782880, 11197600, 11612320, 12027040, 12441760, 6) # mount -o async,noatime /dev/vnd0c /tmp/k 7) # mount | grep /tmp /dev/vnd0c on /tmp/k type ffs (asynchronous, local, noatime) Thank you in advance for reading the thread. PS : I posted similar question in past but this question is little bit different from previous question so posting new thread. Thanks, NK |
|
|||
Thanks for your response.
I tried to create FS but unable to create it on / , /usr/ and /home. (a , d, and e) # newfs /dev/rvnd0a newfs: /dev/rvnd0a: Device not configured # newfs /dev/rvnd0d newfs: /dev/rvnd0d: Device not configured # newfs /dev/rvnd0e newfs: /dev/rvnd0e: Device not configured # # vnconfig -l vnd0: covering /tmp/img.raw on sd0a, inode 105372 vnd1: not in use vnd2: not in use vnd3: not in use # Last edited by niks007; 27th January 2021 at 12:31 PM. Reason: tested with rvnd0 device |
|
||||
My guess is your formatting of vnd0c has destroyed your disklabel. First, check to see if you still have an MBR and MBR partition in place with
# fdisk vnd0 . Then, check your disklabel with # disklabel vnd0 . Each disk may have 15 partitions for data: a,b, and d-p. Partition c is special: it is the whole drive.
|
|
||||
My first thought was along the line of jggimi's. But I then tried to do it without the newfs on 'c' which was the suspected culprit. Yet it didnt' work.
I've been playing with it some more and after some tinkering the following seems to work: Use the -w flag with disklabel # disklabel -Aw vnd0c Then a subsequent run of disklabel will show all the partitions, not just 'c'. And more importantly, newfs on the 'a' partition then works too! Hopefully it will work for niks007 . Last edited by IdOp; 27th January 2021 at 09:49 PM. |
|
||||
One additional note relevant to the topic. At the bottom of the vnconfig(8) man page, there's a CAVEAT which says "The 'c' partition of a vnd image should not be used". This is a bit unclear. For the disklabel step, the 'c' partition must be used. It's for the newfs formatting step where it should not be used. This is good to have in mind when reading the rest of the caveat.
EDIT: It seems the Caveat is gone from recent man pages. I was reading it in the version 6.1 vnconfig(8) man page. Last edited by IdOp; 28th January 2021 at 07:16 PM. |
|
|||
Thanks IdOP,
-Aw options works well and I am able to mount separately. /dev/vnd0a 1952796 4 1855156 0% /tmp/a /dev/vnd0d 6082908 4 5778760 0% /tmp/d /dev/vnd0e 3618524 4 3437596 0% /tmp/e |
|
|||
Quote:
|
|
||||
For clarity:
|
Tags |
cloud, disklabel, images openstack, partitioning |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Install image to which USB partition? | sacerdos_daemonis | OpenBSD Installation and Upgrading | 3 | 27th October 2019 11:11 PM |
Create a partition for OpenBSD in a multi-boot OS environment | cravuhaw2C | OpenBSD Installation and Upgrading | 9 | 14th July 2014 09:16 AM |
cant mount 16th partition because of disklabel limitation | thereisopenbsd | OpenBSD General | 2 | 3rd June 2011 09:10 AM |
create a FAT32 partition and format it. | wesley | OpenBSD General | 2 | 6th November 2010 08:31 AM |
Tried to create new partition using sysinstall but change is not permanent | disappearedng | FreeBSD General | 7 | 6th July 2008 10:00 PM |