Author Topic: Mount USB drive in petitboot to write pb-sos files  (Read 6736 times)

FlyingBlackbird

  • Full Member
  • ***
  • Posts: 102
  • Karma: +3/-0
    • View Profile
Mount USB drive in petitboot to write pb-sos files
« on: January 27, 2020, 12:42:23 pm »
How can I mount a writable USB drive? I have tried many ways (where mount is even showing rw) but the files are not stored on the drive once I plug it into another machine.

It looks like there is an transient overlay file system...

Code: [Select]
# show available devices
ls /var/petitboot/mnt/dev/
# create a mount point
mkdir /mnt/usb
# mount your usb drive
mount /var/petitboot/mnt/dev/sdb /mnt/usb-stick  # is mounted read-only

I have tried various remounts, device paths, options etc. but with no success...

FlyingBlackbird

  • Full Member
  • ***
  • Posts: 102
  • Karma: +3/-0
    • View Profile
Re: Mount USB drive in petitboot to write pb-sos files
« Reply #1 on: January 27, 2020, 03:03:07 pm »
It seems I have found a solution:

https://sthbrx.github.io/blog/2016/08/17/getting-in-sync/

The reason is a "snapshot" layer that intecepts writes into a temporary in-memory file system to support changes of mounted devices without the danger of changing them physically/permanently.

Assuming your USB drive is sda you can remount as read-write, copy files and sync the changes to the physical device like this:

Code: [Select]
mount -o remount,rw /var/petitboot/mnt/dev/sda1
cp /var/log/messages /var/petitboot/mnt/dev/sda1/
pb-event sync@sda1


TODO: I must add this to the wiki somewhere (found no good place for that ATM)
« Last Edit: January 27, 2020, 03:06:08 pm by FlyingBlackbird »