Jump to content

Custom Image


Recommended Posts

Hi!

 

I have been using Armbian for long, but I am new to the Development/build system. I have however set the environment and I can build images.

 

Now, I want to create a custom Armbian image  with the following customization:

 

- Separate ext2 partition for boot

- second partition for LVM

- Root Filesystem in Logical Volume and fixed size.

- Cloud Init, with an extra partition for NoCloud Datasource.

 

I see in the documentation how to install new packages, but not how to partition the SD card. How can I change the partitioning?

 

On the other hand. Can I just build an image without compiling the Kernel? I have no interest in kernel customization in this case, I would rather install the distribution's default without compiling. Is it possible?

 

Link to comment
Share on other sites

I think adjusting fs layout withing build system is not possible at this time.

1 hour ago, rvalle said:

Can I just build an image without compiling the Kernel?

Yes, by passing REPOSITORY_INSTALL it will use pre-built debs. See documentation for more details.

Link to comment
Share on other sites

Hi rvalle,

 

I'm currently working on a project to create a custom Armbian image with specific customizations for Odroid M1 SBCs.

 

The goal is to provide an installation option that includes the following features:

1. Separate ext2 partition for boot.

2. A second partition for LVM (Logical Volume Manager).

3. Root Filesystem within a Logical Volume with a fixed size.

4. Integration of Cloud Init, with an additional partition for NoCloud Datasource.

 

My Odroid M1 SBCs have dual storage, with eMMC for boot (formatted as ext2) and an NVMe drive fully encapsulated into an LVM.

My main challenges include adjusting the installation script to accommodate these customizations and guide users through the process effectively. I would greatly appreciate any information, advice, or guidance you can provide to help me address this challenge successfully.

 

 

Thank you in advance!

Link to comment
Share on other sites

9 часов назад, Frédéric From France сказал:

The goal is to provide an installation option that includes the following features:

1. Separate ext2 partition for boot.

2. A second partition for LVM (Logical Volume Manager).

3. Root Filesystem within a Logical Volume with a fixed size.

4. Integration of Cloud Init, with an additional partition for NoCloud Datasource.

 

Hello, Frederick.
Will you be able to explain a little. Why exactly this configuration.

 

Based on the information you provided, I would do the following:

1) Make a standard "Armbian" image for the selected Operating system.
2) Record the image on the SD card.
3) Check the quality of work by booting from the SD.
4)For training, insert a USB-CD adapter with a clean SD card into the USB.
5) Using only the command line and the command (fdisk or parted) to create a partition table

     and create the required number of partitions. Write down the sequence of actions in a text file.

    This will serve as a template for writing a script.

6) Format the partitions to the selected file system using /usr/sbin/mkfs.FSTYPE
7) To manipulate the LVM partition, use the command '/usr/sbin/lvm'.
Write down the sequence of actions in a mylvm text file in which the first line will contain:

#!/usr/sbin/lvm
Details in 'man lvm'

The lvm command represents its own shell with its own set of commands, so a separate script is needed for it.

You can call it at the required stage in your main BASH script.

 

Write the main BASH script and check if it works correctly.

Link to comment
Share on other sites

Hello Going,

My main objective is to go beyond the standard file system limitations and be able to resize, move, and mirror logical volumes if necessary, as LVM allows. My Armbian systems are Odroid-M1's, 2 will be used as infrastructure services (Free IPA, etc...) and the 3rd one as a router/firewall between different VLANs (users, apps, system, storage, backup, security, DMZ, external). I am using 2 Startech USB32000SPT dual usb to Gb/s ethernet adapters. I will use KVM for virtualization as well as iSCSI volumes provided by a QNAP NAS on the storage VLAN.

 

 

The Armbian installer does not handle LVM at all, it would be nice to enhance it manually. I have tried something similar to:

 

pvcreate /dev/nvme0n1p2
vgcreate ROOTVG /dev/nvme0n1p2

lvcreate -n ROOTLV -L 40g ROOTVG

lvcreate -n SWAP01LV -L 10g ROOTVG

mkswap /dev/ROOTVG/SWAP01LV
sudo swapon /dev/ROOTVG/SWAP01LV

swapon --show

echo '/dev/ROOTVG/SWAP01LV none swap sw 0 0' | sudo tee -a /etc/fstab

 

Limitation: these commands are operating on a partition (p2) of my nvme volume rather than the full volume as the system is already installed on partition p1 and copying the system is not yet implemented (next step).

Only swap is working.

 

What I need: Get assistance on the way to modify armbian-install to get LVM natively from the first step and manage the entire volume rather than a partition.

 

 

 

Edited by Frédéric From France
Link to comment
Share on other sites

For separate ext2 boot partition, I think you can pass BOOTFS_TYPE=ext2 to the compile commandline.

 

If you are ok with writing extensions for armbian build framework or to modify the same, the script that handles partitioning is lib/functions/image/partitioning.sh. There are few hook used functions in there. I am not 100% sure if using those in a custom extension will allow to use LVM for partitioning or not, so you have to try that yourself. Worst case scenario, you have to modify partitioning.sh to add support for LVM.

Link to comment
Share on other sites

Hi Gupta,

I will try, it'd be my first contribution (or try), so let download https://docs.armbian.com/Developer-Guide_Build-Preparation/ first and read what I have to configure first.

the system is booting my current configuration is:

Odroid-M1 with eMMC and nvme storage:
petit-boot is desactivated,

boot is on emmc

the system is on ext4 partition (part 1) of my nvme volume, part 2 

part 1 is a "lvm volume" hosting root-vg and 2 LVs are created: (ROOTLV: for future /, and swap-lv that is already activated)

 

 

<pre><span style="color:#C01C28"><b>asteroid</b></span>:<span style="color:#2AA1B3">~</span>:# lsblk
NAME                                      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
mtdblock0                                  31:0    0   896K  0 disk 
mtdblock1                                  31:1    0   128K  0 disk 
mtdblock2                                  31:2    0     2M  0 disk 
mtdblock3                                  31:3    0     1M  0 disk 
mtdblock4                                  31:4    0    12M  0 disk 
mmcblk0                                   179:0    0  29.1G  0 disk 
└─mmcblk0p1                               179:1    0  28.8G  0 part /boot
                                                                    /media/mmcboot
mmcblk0boot0                              179:32   0     4M  1 disk 
mmcblk0boot1                              179:64   0     4M  1 disk 
nvme0n1                                   259:0    0 465.8G  0 disk 
├─nvme0n1p1                               259:1    0    50G  0 part 
│ ├─asteroid--root--vg-ROOTLV             253:0    0    40G  0 lvm  
│ └─asteroid--root--vg-asteroid--swap--lv 253:1    0    10G  0 lvm  [SWAP]
└─nvme0n1p2                               259:2    0    50G  0 part /var/log.hdd
                                                                    /
</pre>

 

 

my fstab is: 

 

image.thumb.png.05c9a29384ff990335f9d6656bda0674.png

 

vgdisplay

 

<pre><span style="color:#C01C28"><b>asteroid</b></span>:<span style="color:#2AA1B3">~</span>:# vgdisplay
  --- Volume group ---
  VG Name               asteroid-root-vg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               &lt;50.00 GiB
  PE Size               4.00 MiB
  Total PE              12799
  Alloc PE / Size       12799 / &lt;50.00 GiB
  Free  PE / Size       0 / 0   
  VG UUID               "VG UUID MASKED"
</pre>

 

 

lvdisplay

 

<pre><span style="color:#C01C28"><b>asteroid</b></span>:<span style="color:#2AA1B3">~</span>:# lvdisplay
  --- Logical volume ---
  LV Path                /dev/asteroid-root-vg/ROOTLV
  LV Name                ROOTLV
  VG Name                asteroid-root-vg
  LV UUID                "LV UUID MASKED"
  LV Write Access        read/write
  LV Creation host, time asteroid, 2023-08-29 19:42:43 +0200
  LV Status              available
  # open                 0
  LV Size                40.00 GiB
  Current LE             10240
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/asteroid-root-vg/asteroid-swap-lv
  LV Name                asteroid-swap-lv
  VG Name                asteroid-root-vg
  LV UUID                "LV UUID MASKED"
  LV Write Access        read/write
  LV Creation host, time asteroid, 2023-08-29 19:46:51 +0200
  LV Status              available
  # open                 2
  LV Size                &lt;10.00 GiB
  Current LE             2559
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
</pre>

 

/boot/armbianEnv.txt

 

asteroid:/boot:# more /boot/armbianEnv.txt
verbosity=1
bootlogo=false
overlay_prefix=rockchip
fdtfile=rockchip/rk3568-odroid-m1.dtb
rootdev=UUID="REAL UUID IS MASKED"
rootfstype=ext4
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

 

image.png

Link to comment
Share on other sites

Hello, Frédéric From France.

06.11.2023 в 18:05, Frédéric From France сказал:

My main objective is to go beyond the standard file system limitations and be able to resize, move, and mirror logical volumes if necessary, as LVM allows. My Armbian systems are Odroid-M1's, 2 will be used as infrastructure services (Free IPA, etc...) and the 3rd one as a router/firewall between different VLANs (users, apps, system, storage, backup, security, DMZ, external).

There are many questions here.
1) fault tolerance.
2) recovery after exiting the working state of the root file system.

 

(1) CD card, eMMC,  are all flash drives.

Technologically, they are different, but they all have a limited resource for recording.

Armbian tries to reduce the number of write transactions using the overlay file system.

In fact, system write transactions occur in a file located in RAM and are synchronized

with the real file system on the drive at longer intervals than the system ones.

 

(2) You want to place the entire root file system on an LVM partition whose type is linear.

In this case, you have to recreate the initrd to make it work.

And if your drive at the physical level starts to fail or the LVM partition is full, you get very big difficulties for data recovery.

 

06.11.2023 в 18:05, Frédéric From France сказал:

What I need: Get assistance on the way to modify armbian-install to get LVM natively

packages/bsp/common/usr/sbin/armbian-install

This is a very simple script that makes a copy of the OS on your CD card from which you booted and work on an empty nand, SATA, eMMC or NVME.

 

Your drives are eMMC and NVME.
What would I do at the very beginning of the journey, when both drives are clean?
Boot from the SD card and install the system on eMMC.
Boot from eMMC. (for health check)
Mark up the NVME drive as LVM or as BTRFS. (The BTRFS file system will provide you with all the necessary functionality.)
Make logical partitions for target folders "/opt" "/var" "/srv" "/home".
Boot from the SD card and copy the contents of each target folder to the corresponding logical partition while retaining all rights for files.
Add the necessary mount entries in the /etc/fstab file located on the eMMC.
Boot from eMMC. You are the master of the situation!

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines