* Creating a volatile image
@ 2013-07-03 7:48 Paul D. DeRocco
2013-07-03 8:13 ` ChenQi
2013-07-03 8:14 ` Burton, Ross
0 siblings, 2 replies; 5+ messages in thread
From: Paul D. DeRocco @ 2013-07-03 7:48 UTC (permalink / raw)
To: yocto
When an .hddimg image is used on a hard disk or flash drive, the target root
directory is implemented as a loop device referring to the rootfs.img file
contained in that drive. This means it is a true non-volatile file system.
Is there a way to make the entire file system volatile?
I'm trying to ensure that my flash drive is written to as rarely as
possible. To this end, I'm putting my app's volatile data on a separate
partition, and I'd like to run the OS out of a big ramdisk, loading it on
startup and then discarding it on shutdown. In other words, I want a
Groundhog Day system, which always boots up as though it is a brand new
clean install.
I've spent a couple hours trying to decipher various .bbclass files,
Googling about the various file systems, and so on, and I haven't seen
anything that looks like this capability is already provided somehow in the
Yocto system. Is there an easy way to do this? Or is there only a hard way
to do it, involving way more expertise in the build system than I've got?
Alternatively, is it practical to make the existing file system readonly? My
system is based on core-image-base, with no graphics. What will break if it
can't write to anything outside of /tmp or /run or /media/ram or
/var/volatile? And is there a built-in way to do that?
--
Ciao, Paul D. DeRocco
Paul mailto:pderocco@ix.netcom.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Creating a volatile image
2013-07-03 7:48 Creating a volatile image Paul D. DeRocco
@ 2013-07-03 8:13 ` ChenQi
2013-07-03 8:14 ` Burton, Ross
1 sibling, 0 replies; 5+ messages in thread
From: ChenQi @ 2013-07-03 8:13 UTC (permalink / raw)
To: yocto
On 07/03/2013 03:48 PM, Paul D. DeRocco wrote:
> When an .hddimg image is used on a hard disk or flash drive, the target root
> directory is implemented as a loop device referring to the rootfs.img file
> contained in that drive. This means it is a true non-volatile file system.
> Is there a way to make the entire file system volatile?
Three ways to achieve this goal.
1. If you're using yocto 3.8 kernel, you can enable aufs by add the
following line to local.conf.
KERNEL_FEATURES_append = " features/aufs/aufs-enable.scc"
This will enable the aufs support and your live image (iso or hddimg)
will appear to be writable.
This aufs support in live image is added recently.
commit: 29e55997caeb9c6367f9a340e153f829228f36ed
subject: init-live.sh: try to make a union mount when possible
2. If you're using other kernel versions, an option is to use
device-mapping.
But you might need to write your own recipe to include the dmsetup
command into the image.
In addition, you need to modify the init-live.sh script a little.
dmsetup is not used in OE/Yocto for now.
ArchLinux uses this method to make its liveCD version work.
3. As a temporary workaround, you can bind mount the directory you need
to write to with a tmpfs.
e.g.
mkdir -p /var/volatile/lib
mount --bind /var/lib /var/volatile/lib
Best Regards,
Chen Qi
> I'm trying to ensure that my flash drive is written to as rarely as
> possible. To this end, I'm putting my app's volatile data on a separate
> partition, and I'd like to run the OS out of a big ramdisk, loading it on
> startup and then discarding it on shutdown. In other words, I want a
> Groundhog Day system, which always boots up as though it is a brand new
> clean install.
>
> I've spent a couple hours trying to decipher various .bbclass files,
> Googling about the various file systems, and so on, and I haven't seen
> anything that looks like this capability is already provided somehow in the
> Yocto system. Is there an easy way to do this? Or is there only a hard way
> to do it, involving way more expertise in the build system than I've got?
>
> Alternatively, is it practical to make the existing file system readonly? My
> system is based on core-image-base, with no graphics. What will break if it
> can't write to anything outside of /tmp or /run or /media/ram or
> /var/volatile? And is there a built-in way to do that?
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Creating a volatile image
2013-07-03 7:48 Creating a volatile image Paul D. DeRocco
2013-07-03 8:13 ` ChenQi
@ 2013-07-03 8:14 ` Burton, Ross
2013-07-03 8:26 ` Paul D. DeRocco
1 sibling, 1 reply; 5+ messages in thread
From: Burton, Ross @ 2013-07-03 8:14 UTC (permalink / raw)
To: Paul D. DeRocco; +Cc: yocto
On 3 July 2013 08:48, Paul D. DeRocco <pderocco@ix.netcom.com> wrote:
> Alternatively, is it practical to make the existing file system readonly? My
> system is based on core-image-base, with no graphics. What will break if it
> can't write to anything outside of /tmp or /run or /media/ram or
> /var/volatile? And is there a built-in way to do that?
You can set the "read-only-rootfs" image feature (never tried it
myself, so YMMV), but if you turn off atime writes to / you won't be
making that many writes to / anyway.
Ross
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Creating a volatile image
2013-07-03 8:14 ` Burton, Ross
@ 2013-07-03 8:26 ` Paul D. DeRocco
2013-07-03 9:45 ` Burton, Ross
0 siblings, 1 reply; 5+ messages in thread
From: Paul D. DeRocco @ 2013-07-03 8:26 UTC (permalink / raw)
To: 'Burton, Ross'; +Cc: yocto
> From: Burton, Ross
>
> You can set the "read-only-rootfs" image feature (never tried it
> myself, so YMMV),
That would certainly be the simplest thing to try.
> but if you turn off atime writes to / you won't be
> making that many writes to / anyway.
How does one turn off atime? By modifying /etc/fstab? How is that done? By
supplying a different source file to get copied into the image, or by
overwriting the built-in one in my own recipe? I need to do that anyway,
since I have a second partition to mount.
--
Ciao, Paul D. DeRocco
Paul mailto:pderocco@ix.netcom.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Creating a volatile image
2013-07-03 8:26 ` Paul D. DeRocco
@ 2013-07-03 9:45 ` Burton, Ross
0 siblings, 0 replies; 5+ messages in thread
From: Burton, Ross @ 2013-07-03 9:45 UTC (permalink / raw)
To: Paul D. DeRocco; +Cc: yocto
On 3 July 2013 09:26, Paul D. DeRocco <pderocco@ix.netcom.com> wrote:
>> but if you turn off atime writes to / you won't be
>> making that many writes to / anyway.
>
> How does one turn off atime? By modifying /etc/fstab? How is that done? By
> supplying a different source file to get copied into the image, or by
> overwriting the built-in one in my own recipe? I need to do that anyway,
> since I have a second partition to mount.
You can override the fstab provided by base-files with your own, and
use the mount option "noatime".
Ross
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-07-03 9:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-03 7:48 Creating a volatile image Paul D. DeRocco
2013-07-03 8:13 ` ChenQi
2013-07-03 8:14 ` Burton, Ross
2013-07-03 8:26 ` Paul D. DeRocco
2013-07-03 9:45 ` Burton, Ross
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.