You are not logged in.

#1 2016-02-03 10:59:03

Marcos FRM
Member
Registered: 2013-02-10
Posts: 14

Does pacman issue fsync()?

I was worried when approximately one minute after pacman completed upgrading some packages my zone had a power outage. As things are still working, I think my XFS file system had enough time to flush data to disk by its own (if pacman does nothing to ensure persistence). Does pacman issue fsync() for the files it writes? Or a at least a sync() after completion?

Offline

#2 2016-02-03 11:10:51

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,465
Website

Re: Does pacman issue fsync()?

Not a sys admin topic, moving to pacman discussion.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2016-02-03 11:23:24

progandy
Member
Registered: 2012-05-17
Posts: 5,269

Re: Does pacman issue fsync()?

If I remember correctly, it doesn't do that. For pacman 5.0 there should be a sync hook available
https://github.com/andrewgregory/pachooks/


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2016-02-03 11:26:29

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,430

Re: Does pacman issue fsync()?

Afaik it doesn't by default, but as of pacman 5 can be easily made to do so, see

man alpm-hooks

(the example being literally what you are asking for even)

Edit: I should press the preview button more before posting tongue

Last edited by V1del (2016-02-03 11:30:14)

Offline

#5 2016-02-03 11:44:43

Marcos FRM
Member
Registered: 2013-02-10
Posts: 14

Re: Does pacman issue fsync()?

Thanks. I will take a look.

I still think this should be in pacman's code. fsync() on every file is expensive, but a sync() after completion would be doable, enabled by an option in /etc/pacman.conf (SyncOnCompletion or so). There is also syncfs() (kernel 2.6.39+/glibc 2.14+) to sync only selected mount points.

https://lwn.net/Articles/433384/

Offline

#6 2016-02-03 11:53:46

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: Does pacman issue fsync()?

Marcos FRM wrote:

I still think this should be in pacman's code. fsync() on every file is expensive, but a sync() after completion would be doable

I think you are confusing two things. The hooks run either prior to or after the complete transaction instead of after each package (that is what the install files are for). So, you can easily run sync after every complete pacman transaction/session.

Anyway, take a look at the link progandy gave. And take a look at sync.hook in particular.

E: Formatting

Last edited by runical (2016-02-03 11:54:41)

Offline

#7 2016-02-03 12:02:25

Marcos FRM
Member
Registered: 2013-02-10
Posts: 14

Re: Does pacman issue fsync()?

Yes, I know that. My english is not the best, sorry.

It should be in pacman's code because data integrity is IMO priority number one for package managers: http://article.gmane.org/gmane.comp.fil … eral/62090

Offline

#8 2016-02-03 12:28:28

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,481
Website

Re: Does pacman issue fsync()?

It can be handled by a hook, so will not be added to pacman.

Offline

Board footer

Powered by FluxBB