# Restarting part\_block and vfs server

**URL:** <https://genode.discourse.group/t/restarting-part-block-and-vfs-server/15>\
**Category:** Developer's Corner\
**Created:** [August 9, 2024, 4:06pm UTC](https://genode.discourse.group/t/restarting-part-block-and-vfs-server/15 "2024-08-09T16:06:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttcoder](https://dub1.discourse-cdn.com/flex006/user_avatar/genode.discourse.group/ttcoder/32/9_2.png) [@ttcoder](https://genode.discourse.group/u/ttcoder)\
**Post date:** [August 9, 2024, 4:06pm UTC](https://genode.discourse.group/t/restarting-part-block-and-vfs-server/15/1 "2024-08-09T16:06:07Z")

</div>

Howdy Genodians…

Well let’s get the ball rolling. There’s a question I’ve been wondering for a couple days that would probably be on-topic for the mailing-list, but I figure it would be nice to post it here to test drive the new forum instead. If there was a “development” channel it would probably go there.

The question is… I’m implementing a partition-setup tool for my Genode-based system. Currently getting to grips with “gpt\_tool”. Of course it cannot access the ahci driver if part\_block and vfs are already plugged into it.

So I figure, the right way to go about it is similar to (what I believe) SculptOS does : tear down the vfs, then part\_block (there might be ‘dangling’ file descripitors in apps ?), do my gpt\_write and ntfs formatting, then restore things in reverse order. How does that sound.

P.S. I’m “ttcoder” from the mailing-list, Norman kindly offered me to help animate this discourse a bit. I hope to allocate time as I do on the mailing list. That is to say, occasional posts and response. One benefit I can think of, is the ability to edit posts for spelling mistakes (I tend to make lots of those!), vs emails which are “forever” ^^

---

<div class="post-metadata">

**Author:** ![nfeske](https://dub1.discourse-cdn.com/flex006/user_avatar/genode.discourse.group/nfeske/32/6_2.png) [@nfeske](https://genode.discourse.group/u/nfeske)\
**Post date:** [August 15, 2024, 7:01pm UTC](https://genode.discourse.group/t/restarting-part-block-and-vfs-server/15/2 "2024-08-15T19:01:07Z")

</div>

That is indeed how it is implemented in Sculpt OS. The partition operations are presented only if the block device is currently unused. So the user needs to take a deliberate step to release the block device from use (un-use, un-inspect). So the complicated problem of winding down the VFS is conveniently side-stepped as this is the job of the user.

For chaining operations, like expanding a partition followed by resizing the contained file system, the sculpt manager tracks the exit state of the spawned components using init’s state report. Once gpt\_write exits, its exit code becomes visible in the state reported by the runtime init. When seeing the desired state, the sculpt manager enters the next stage by removing the gpt\_write component from the runtime-init config and adding the resize-fs component instead.

---

<div class="post-metadata">

**Author:** ![ttcoder](https://dub1.discourse-cdn.com/flex006/user_avatar/genode.discourse.group/ttcoder/32/9_2.png) [@ttcoder](https://genode.discourse.group/u/ttcoder)\
**Post date:** [August 15, 2024, 7:15pm UTC](https://genode.discourse.group/t/restarting-part-block-and-vfs-server/15/3 "2024-08-15T19:15:44Z")

</div>

Ok I was on the right track then. Thanks. Pushed a commit today along these lines, although my init-based stack does not yet propagate the exit status – so as a field-expedient work-around I make the code sleep for a few seconds inbetween chained ops (😊 ). It’s only a unit test so far, but once I integrate that into a ‘distro’ I’ll test for real. I purchased a used HDD so that I can safely test wiping partitions and re-format on “bare metal” without worrying about losing any of my data ^^
