My Tiny Linux

I built some very small linux systems that I use to create virtual clusters in seconds. All the software has been compiled from source against the MUSL library and despite the small size they provide many features, tinyzfs for example is only 28MB but has:

QEMU, LXC, ZFS, http/s, vde2, wpa_supplicant, ddrescue, lynx, mdadm, iperf3, nfs, parted, stress, ntfs3, ksmbd, sysstats, etc. etc

Here is a screencast with migration between metal nodes: My Tiny Linux.

Last update on 26/11/2021 - kernel 5.15.5 changelog.

max

Testing Kernel 5.15

The kernel 5.15 is out and has many new features and improvements.

The new kernel has already implemented on the my tinylinux: changelog.

I have tested the new ntfs driver ( NTFS3 ) and the SMB3 server support ( ksmbd ), the ksmbd userspace tools have been added to the tinylinux.

ksmbd quick test. ( KSMBD screencast )

Start a VM with vmstart, here a screencast that shows how to start a VM screencast

  • Enter the VM: sshe 10.0.3.1
  • Load the ksmb module: modprobe ksmbd
  • Create the configuration directory: mkdir /etc/ksmbd
  • Add a share “on the fly”: ksmbd.addshare -a myshare -o "guest ok = yes, writable = yes, path = /usr/share/doc"
  • Start ksmbd user space daemon: ksmbd.mountd

Now the share can be mounted or accessed from the host, e.g:

smbclient //10.0.3.1/myshare

Enter WORKGROUP\root's password: 
Anonymous login successful
Try "help" to get a list of possible commands.

smb: >ls

 .                                   D        0  Sun May  2 11:56:40 2021
  ..                                  D        0  Sun May  2 11:56:40 2021
  strace.txt                          A      860  Fri May 18 21:50:35 2018
  ddrescue_passes.txt                 A     1656  Sat Apr  2 20:33:59 2016
  README                              A      387  Mon Oct 12 11:15:32 2020
  screen.txt                          A     1699  Sat Apr  2 20:33:59 2016
  sysstat.txt                         A     2938  Fri May 18 21:51:28 2018
  socat.txt                           A     4245  Fri May 18 21:33:14 2018
  tmux_cheat_sheet.html               A    26518  Mon Oct 21 18:08:11 2019
  ncat.txt                            A     1187  Fri May 18 21:13:01 2018
  iproute2.txt                        A     1818  Fri May 18 21:45:01 2018
  vmstart2.txt                        A     1483  Wed Oct  2 12:04:47 2019
  qemu.txt                            A    13278  Fri May 18 21:40:55 2018
  ssh_reverse_tunnel.txt              A      314  Tue Nov 21 21:49:54 2017

		50401 blocks of size 4096. 29053 blocks available

NTFS3 quick test

  • Connecting the monitor interface to check the block devices already connected:

echo "info block" | ncat -U /tmp/mon.1

QEMU 5.2.0 monitor - type 'help' for more information
(qemu) info block
virtio0 (#block181): /media/sdb2/vcluster/vm1.qcow2 (qcow2)
    Attached to:      /machine/peripheral-anon/device[1]/virtio-backend
    Cache mode:       writeback
    Backing file:     /media/sdb2/vcluster/tinyzfs.img (chain depth: 1)

ide1-cd0: [not inserted]
    Attached to:      /machine/unattached/device[23]
    Removable device: not locked, tray closed

floppy0: [not inserted]
    Attached to:      /machine/unattached/device[17]
    Removable device: not locked, tray closed

sd0: [not inserted]
    Removable device: not locked, tray closed
  • Now I add the sdb1 partition that contains window 10 ( I use only for testing and doesn’t contain any important data )

echo "drive_add 1 if=none,file=/dev/sdb1,format=raw,id=disk1" | ncat -U /tmp/mon.1

OK

echo "device_add virtio-blk-pci,drive=disk1,id=myvirtio1" | ncat -U /tmp/mon.1

echo "info block" | ncat -U /tmp/mon.1

virtio0 (#block193): /media/sdb2/vcluster/vm1.qcow2 (qcow2)
    Attached to:      /machine/peripheral-anon/device[1]/virtio-backend
    Cache mode:       writeback
    Backing file:     /media/sdb2/vcluster/tinyzfs.img (chain depth: 1)

ide1-cd0: [not inserted]
    Attached to:      /machine/unattached/device[23]
    Removable device: not locked, tray closed

floppy0: [not inserted]
    Attached to:      /machine/unattached/device[17]
    Removable device: not locked, tray closed

sd0: [not inserted]
    Removable device: not locked, tray closed

disk1 (#block562): /dev/sdb1 (raw)
    Attached to:      /machine/peripheral/myvirtio1/virtio-backend
    Cache mode:       writeback
  • Back to the VM: sshe 10.0.3.1

root@vm1:~#parted /dev/vdb p

Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 227GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End    Size   File system  Flags
 1      0.00B  227GB  227GB  ntfs

root@vm1:~#mount -t ntfs3 /dev/vdb /media/test

root@vm1:~#grep ntfs /proc/mounts

/dev/vdb /media/test ntfs3 rw,relatime,uid=0,gid=0,iocharset=utf8 0 0

  • Creating a 300MB file:

root@vm1:~#dd if=/dev/zero of=/media/test/deleteme bs=1M count=300 status=progress

300+0 records in
300+0 records out
314572800 bytes (315 MB, 300 MiB) copied, 0.812832 s, 387 MB/s

Soon a screencast that shows this process

max

Monitoring With Sysstats

The SYSSTATS utilities are a collection of monitoring tools for linux. They come with almost every Linux distribution and most unix people are confident wit sar/iostat/pidstat, etc. Those utilities are precious when you need to have quick look at the system via command line.

When the automatic data collection is enabled the data is kept in /var/log/sysstat/ or where has been defined on SA_DIR in the sysstat configuration. The data will be rotated according to the HISTORY parameter.

Recent versions of sysstats have a version of sadf that can generate svg images of the monitoring, uploading them to a website can give a quick view of the system.

Here is “one line” script that can be managed by cron:

sadf script

max