- HomePage
- Create-bootable-images
- Create-what-is-only-needed-repo
- Create-alpine-rescue-disk
- Boot-dance-everything-in-usr-folder
- True-diskless-boot
- Diskless-install-on-devices-with-2gb-ram
- Diskless-install-on-devices-with-1gb-ram
- About-diskless-boot
- How-to-share-you-apks-repo
- How-to-manage-shared-apks-repo
- How-to-manage-shared-apks-repo-2
Creating diskless-boot (Part 2) - installs on-devices-with-2gb-ram
Some questions answered here.
- Is there a way to do a disk-less install on low RAM devices.
- How can I simulate /sys like installs(disk-based) using disk-less installs.
RAM based install of Alpine Linux on device with 2GB ram
- Variant of diskless install using
/usron disk. - Meant for end-users(non-novice) who can post-boot do some simple [un]mounts to achieve the goal.
Step 1 - Diskless boots
Methods below assume you have an extra disk/storage media with sufficient writable space attached to the booted device.
Also, extra disk attached has been formatted so as it can be further used in steps below.
Method 1 - Boot from Cdrom
localhost:~# df -h
Filesystem Size Used Available Use% Mounted on devtmpfs 10.0M 0 10.0M 0% /dev shm 483.1M 0 483.1M 0% /dev/shm /dev/sr0 1.1G 1.1G 0 100% /media/cdrom tmpfs 483.1M 11.2M 472.0M 2% / tmpfs 193.3M 44.0K 193.2M 0% /run /dev/loop0 233.0M 233.0M 0 100% /.modloop
localhost:~# blkid
/dev/loop/0: TYPE="squashfs" /dev/sr0: LABEL="alpine-ext 3.22.0 x86_64" TYPE="iso9660" /dev/sda1: UUID="d96cb1fc-6936-4f6e-ba14-9cd43fd1f149" TYPE="ext3" /dev/loop0: TYPE="squashfs"
Note: /dev/sda1 above is attached extra disk.
Method 2 - Boot from Disk
Directory/files structures - of alpine boot disk
(1)
/media/sda1/ <- can be /media/usb /media/sda
|-- apks <- installed from alpine-extended-3.22.0-x86_64.iso
| `-- x86_64
| |-- APKINDEX.tar.gz
| |-- acct-6.6.4-r2.apk
| |-- ....
| |-- modloop-lts
| |-- syslinux
| `-- zstd-libs-1.5.7-r0.apk
|-- boot
| |-- System.map-lts
| |-- ....
| `-- vmlinuz-lts
|-- cache
| `-- installed
|-- efi
| `-- boot
| `-- bootx64.efi
`-- lost+found
localhost:~# df -h
Filesystem Size Used Available Use% Mounted on devtmpfs 10.0M 0 10.0M 0% /dev shm 734.4M 0 734.4M 0% /dev/shm /dev/sda1 1.5G 1.1G 396.9M 74% /media/sda1 tmpfs 734.4M 11.2M 723.2M 2% / tmpfs 293.8M 44.0K 293.7M 0% /run /dev/loop0 233.0M 233.0M 0 100% /.modloop
Note: /dev/sda1 above is your boot disk, do not use it for /usr.
localhost:~# blkid
/dev/loop/0: TYPE="squashfs" /dev/sdb1: UUID="d96cb1fc-6936-4f6e-ba14-9cd43fd1f149" TYPE="ext3" /dev/sda1: UUID="68FB-538D" TYPE="vfat" /dev/loop0: TYPE="squashfs"
Note: /dev/sdb1 above is attached extra disk.
Step 2 - Create/mount usr image, partition, or bind
Note: make sure usr image, partition, or folder prepared for /usr is clean and has no files in it.
For methods below, its assumed /dev/sdb1 is extra attached device of size greater than 4Gb. Its is advised to re-check if its the intended device.
Caveat: currently methods below is done immediately after new boot, i.e no saved apkovl is used.
localhost:~# du -csh /usr
8.5M /usr 8.5M total
Current space utilized by /usr folder on Ram after fresh boot.
Method 1 - Use empty partition.
- Caution: make sure device/partition is not in use for any other purpose.
mkdir /tmp/usr
mount -t ext3 /dev/sdb1 /tmp/usr # needs to be empty
cp -a /usr/* /tmp/usr/
umount /tmp/usr && mount /dev/sdb1 /usr
Method 2 - Create an ext3 image on any extra disk and mount it.
mkdir /media/sdb1
mount -t ext3 /dev/sdb1 /media/sdb1
apk add e2fsprogs
mkfs.ext3 -d /usr /media/sdb1/usr.img 2G
mount /media/sdb1/usr.img /usr
Method 3 - Bind (empty folder on any mounted partition).
mkdir /media/sdb1
mount -t ext3 /dev/sdb1 /media/sdb1
mkdir /media/sdb1/usr # needs to be empty
cp -a /usr/* /media/sdb1/usr/
mount -o bind /media/sdb1/usr /usr
Step 3
- Run
setup-alpineas usual - Run
setup-desktop- desktop xfce - success! (any other lighter desktop should be ok)
If installing OS, having SWAP disk enabled can help improve performance.
Where and how are these kind of setups useful?
Standard diskless boot will use RAM to store /usr files. On low Ram devices this becomes critical and limits the use of devices. Its been tested and observed that installing/using desktops on it becomes impractical.
Author experience
- I often use these methods on devices with low ram. With this method I have been effectively using XFCE Desktop on ASUS Netbook(x205taw - atom x86_64) with 2Gb Ram.
Author
V.Krishn
Resources