/srv empty after booting, recovering folders after reboot

Hi everybody,

I’m working on a local website in /srv/www//vhosts and very often (not everytime) when I boot my computer, /srv is empty : all folders (firebird, tftpboot and specially www have vanished - I have no idea about what the 2 first folders are). I have to reboot and everything is there again.

I’m on KDE Plasma with Dolphin.
The filesystem on my root partition is BtrFs (/home is Ext4, compatibility compliance to Dropbox). There’s enough space on it.
I generally use bluefish as IDE and files are saved with my username as owner, from time to time I chown everything in /srv/www to wwwrun. My username is member of wwwrun group.
I checked my HDD with smartmontools - smartctl and saw nothing special, there are no pending sectors and total uptime is less than 100 hours (the drive is brand new).
The logs don’t show any error related to /srv ("/srv successfully mounted ").

I did’nt notice that kind of event on any other folder.

I don’t know at this time what additional information would be relevant, I’ll give what I’ll be asked for.

Does anybody has a tip about what could cause that issue ? I’m afraid some day there could be definitely nothing left in /srv even after reboot … Of course I back it up everytime before shutting down … unless I forget it.

Thanks !

What do you mean by “/srv empty”
By default, if you’ve installed LAMP using the LAMP pattern (and most other ways) there should be subfolders like www and htdocs
And then there would be your custom files specific to your websites.

Are those default webserver files or are those missing, too?

TSU

You say so, but you do not prove it.

Please post

ls -l /srv

for both situations.

Thinking about your situation a bit,
I suspect you’re opening in a graphical File Manager.
Recommend opening in command line instead… If you need to see a graphical representation of the file tree structure, install “tree” for that functionality.
Hard to say what might cause a graphical glitch…
Could you be trying to view your folders immediately after a bootup? What if you wait at least 15 minutes or so for startup processes to complete?

TSU

Hi tsu2, thanks for your answer !

I mean all folders that are normally inside don’t appear - they’ve not really vanished actually since after reboot they are here again …

Everything is missing (btw I’m using Postgresql so it’s a LAPP installation), /srv folder is really empty after booting, let’s say half of times. But of course all my files I’m working on re-appear at first reboot so it’s a minor issue : right now I’m working on /srv/www/vhosts/small-erp.local/index.php, for instance. But what if some day it remains empty ?

Erik

Hello Hank !

I can’t prove right now since everything is working fine tonight. All I can tell you is that when Dolphin displayed nothing in /srv I did a ‘cd /srv && ls’ in terminal I got an empty line.

Now, doing that, here’s the outcome :


erik@linux-5n3o:~> cd /srv && ls -l
total 0
drwxr-x--- 1 firebird firebird  0  9 juil. 16:16 firebird
drwxr-xr-x 1 tftp     tftp      0 31 juil. 16:49 tftpboot
drwxr-xr-x 1 wwwrun   wwwrun   38  4 juil. 16:14 www 

OK, thanks. This together with the other ls is prove enough to me.
(I would not trust Dolphin alone, but always shortcut it and other GUI tools to be sure).

BTW, /srv is not on a separate file system?

Wow ! didn’t expect startup processes to take 15 minutes. I’ll give it a try anyway.
As my other replies could show, I tried both graphical File Manager and terminal.

I see that tree is already installed. I just discover it, and it is really a cool package. I’ll use it next time my /srv looks empty ! So I assume better wait till it occurs again.

Erik

Hi Henk (not Hank, sorry), /srv is on the same root system as everything except /home, which resides on a separate partition and a specific mountpoint (this is an ordinary configuration)

Nevertheless adding my fstab here wont do no any harm.

erik@linux-5n3o:/srv> sudo cat /etc/fstab
UUID=63d518af-52ff-4179-b186-340a7abd02b8  /                       btrfs  defaults                      0  0
UUID=63d518af-52ff-4179-b186-340a7abd02b8  /.snapshots             btrfs  subvol=/@/.snapshots          0  0
UUID=7f106034-fa4d-4db0-985e-d6cac4d28178  swap                    swap   defaults                      0  0
UUID=63d518af-52ff-4179-b186-340a7abd02b8  /var                    btrfs  subvol=/@/var                 0  0
UUID=63d518af-52ff-4179-b186-340a7abd02b8  /usr/local              btrfs  subvol=/@/usr/local           0  0
UUID=63d518af-52ff-4179-b186-340a7abd02b8  /tmp                    btrfs  subvol=/@/tmp                 0  0
UUID=63d518af-52ff-4179-b186-340a7abd02b8  /srv                    btrfs  subvol=/@/srv                 0  0
UUID=63d518af-52ff-4179-b186-340a7abd02b8  /root                   btrfs  subvol=/@/root                0  0
UUID=63d518af-52ff-4179-b186-340a7abd02b8  /opt                    btrfs  subvol=/@/opt                 0  0
UUID=72aa2929-b98f-449b-935c-a833d98d5655  /home                   ext4   data=ordered                  0  2
UUID=63d518af-52ff-4179-b186-340a7abd02b8  /boot/grub2/x86_64-efi  btrfs  subvol=/@/boot/grub2/x86_64-efi  0  0
UUID=63d518af-52ff-4179-b186-340a7abd02b8  /boot/grub2/i386-pc     btrfs  subvol=/@/boot/grub2/i386-pc  0  0
UUID=58ED-09A0                             /boot/efi               vfat   defaults                      0  0
LABEL=Media                                /home/erik/Media        ext4   user_xattr,data=ordered       0  0


It was just a thought. It is very strange what you report, so one tries everything :wink:

I agree with you, it sounds really uncommon. Have I done some kind of silly manipulation ? I can’t remember of that, but it’s generally the case. But it would then happen all the time : on the contrary it is a random event.

I am grateful for your thoughts and guesses anyway.

Hi,

today this problem occurred again, so I tried to check filesystem using ls and tree :


erik@linux-5n3o:~> cd /srv
erik@linux-5n3o:/srv> ls -l
total 0
erik@linux-5n3o:/srv> 
erik@linux-5n3o:/srv> tree
.

0 directories, 0 files
erik@linux-5n3o:/srv> 

Then I waited to see whether things could get better after booting process completion. But they didn’t.

And now after reboot :


erik@linux-5n3o:/srv> ls -l
total 0
drwxr-x--- 1 firebird firebird  0  9 juil. 16:16 firebird
drwxr-xr-x 1 tftp     tftp      0 31 juil. 16:49 tftpboot
drwxr-xr-x 1 wwwrun   wwwrun   38  4 juil. 16:14 www
erik@linux-5n3o:/srv> 

I see it, but I cannot believe it :frowning:

I take your disbelief as a mark of empathy … :expressionless:

Erik

That is correct.

I recall this problem several times a day in the hope that I will get a"AHA Erlebnis". In vain thus far :wink:

If BTRFS maybe there is a glitch since most sub-directories in BTRFS are mounted so that mount is randomly failing??? Week sector maybe run smartctrl

Recommend checking your file system integrity.

https://btrfs.wiki.kernel.org/index.php/Btrfsck

You’ll notice like most articles that you shouldn’t run a “repair” unless there is no alternative, it can be destructive.
So, for instance you might start with the following which will safely fix certain problems in your case

btrfs scrub start /srv/

If this is a Production server system,
You might want to consider how critical this problem might be, whether you feel you can live it or not and if one day you can’t recover how valuable the data is(ie backup)…
IIRC the procedure when running a repair is similar to the procedure recovering a database… After a successful repair, you shouldn’t rely on its integrity. You should immediately create a new volume and copy your data into that, then reconfigure mounting the new copy in place of the original.

TSU

Please check


sudo journalcrl | grep srv

First of all thanks everybody, it’s nice to feel your concern.

Now, for smartctl, I told before that I had checked my hd with it but as I’m not a specialist, I put the last output hereunder.


erik@linux-5n3o:~> sudo smartctl -a /dev/sdc
[sudo] Mot de passe de root : 
smartctl 7.0 2019-05-21 r4917 [x86_64-linux-5.2.8-1-default] (SUSE RPM)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 3.5
Device Model:     ST1000DM010-2EP102
Serial Number:    Z9AP0YP5
LU WWN Device Id: 5 000c50 0af988c32
Firmware Version: CC43
User Capacity:    1 000 204 886 016 bytes [1,00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Tue Aug 20 18:47:44 2019 +04
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                                        was never started.
                                        Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever 
                                        been run.
Total time to complete Offline 
data collection:                (    0) seconds.
Offline data collection
capabilities:                    (0x73) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        No Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine 
recommended polling time:        (   1) minutes.
Extended self-test routine
recommended polling time:        ( 105) minutes.
Conveyance self-test routine
recommended polling time:        (   2) minutes.
SCT capabilities:              (0x1085) SCT Status supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   082   063   006    Pre-fail  Always       -       191854375
  3 Spin_Up_Time            0x0003   096   096   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       87
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   072   060   045    Pre-fail  Always       -       20741792
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       551
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       87
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       0
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0 0 0
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   061   055   040    Old_age   Always       -       39 (Min/Max 22/39)
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       89
194 Temperature_Celsius     0x0022   039   020   000    Old_age   Always       -       39 (0 20 0 0 0)
195 Hardware_ECC_Recovered  0x001a   001   001   000    Old_age   Always       -       191854375
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       551h+05m+38.034s
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       2591314361
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       1108411790

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%       544         -
# 2  Short offline       Completed without error       00%       532         -
# 3  Short offline       Completed without error       00%       517         -
# 4  Short offline       Completed without error       00%       511         -
# 5  Short offline       Completed without error       00%       504         -
# 6  Short offline       Completed without error       00%       498         -
# 7  Short offline       Completed without error       00%       493         -
# 8  Short offline       Completed without error       00%       486         -
# 9  Short offline       Completed without error       00%       477         -
#10  Short offline       Completed without error       00%       473         -
#11  Short offline       Completed without error       00%       468         -
#12  Short offline       Completed without error       00%       465         -
#13  Short offline       Completed without error       00%       458         -
#14  Short offline       Completed without error       00%       445         -
#15  Short offline       Completed without error       00%       439         -
#16  Extended offline    Completed without error       00%       430         -
#17  Short offline       Completed without error       00%       418         -
#18  Short offline       Completed without error       00%       411         -
#19  Short offline       Completed without error       00%       409         -
#20  Short offline       Completed without error       00%       405         -
#21  Short offline       Completed without error       00%       391         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.


Then with scrub:


erik@linux-5n3o:~> sudo btrfs scrub start /srv/
[sudo] Mot de passe de root : 
scrub started on /srv/, fsid 63d518af-52ff-4179-b186-340a7abd02b8 (pid=5334)
erik@linux-5n3o:~> sudo btrfs scrub status /srv/
UUID:             63d518af-52ff-4179-b186-340a7abd02b8
Scrub started:    Tue Aug 20 18:57:02 2019
Status:           finished
Duration:         0:02:20
Total to scrub:   23.12GiB
Rate:             169.05MiB/s
Error summary:    no errors found
erik@linux-5n3o:~> 

And finally journalctl :


erik@linux-5n3o:~> sudo journalctl | grep srv
[sudo] Mot de passe de root : 
août 20 18:26:16 linux-5n3o systemd[1]: Mounted /srv.
août 20 18:26:25 linux-5n3o start_apache2[1189]: AH00112: Warning: DocumentRoot [/srv/www/vhosts/andryna-chic.local] does not exist
août 20 18:57:02 linux-5n3o sudo[5329]:     erik : TTY=pts/0 ; PWD=/home/erik ; USER=root ; COMMAND=/usr/sbin/btrfs scrub start /srv/
août 20 19:01:26 linux-5n3o sudo[5650]:     erik : TTY=pts/0 ; PWD=/home/erik ; USER=root ; COMMAND=/usr/sbin/btrfs scrub status /srv/
août 20 19:03:39 linux-5n3o sudo[5766]:     erik : TTY=pts/0 ; PWD=/home/erik ; USER=root ; COMMAND=/usr/sbin/btrfs scrub start /srv
août 20 19:03:54 linux-5n3o sudo[5785]:     erik : TTY=pts/0 ; PWD=/home/erik ; USER=root ; COMMAND=/usr/sbin/btrfs scrub status /srv
août 20 19:04:26 linux-5n3o sudo[5816]:     erik : TTY=pts/0 ; PWD=/home/erik ; USER=root ; COMMAND=/usr/sbin/btrfs scrub status /srv
août 20 19:05:07 linux-5n3o sudo[5851]:     erik : TTY=pts/0 ; PWD=/home/erik ; USER=root ; COMMAND=/usr/sbin/btrfs scrub status /srv
août 20 19:05:52 linux-5n3o sudo[5891]:     erik : TTY=pts/0 ; PWD=/home/erik ; USER=root ; COMMAND=/usr/sbin/btrfs scrub status /srv
août 20 19:05:58 linux-5n3o sudo[5900]:     erik : TTY=pts/0 ; PWD=/home/erik ; USER=root ; COMMAND=/usr/sbin/btrfs scrub status /srv
erik@linux-5n3o:/srv/www/vhosts> sudo journalctl -b -1 | grep srv
Specifying boot ID or boot offset has no effect, no persistent journal was found.




(I deleted a virtual host folder but not the related file in /etc/apache2 so apache2 complains …)

The issue is still there, not very often but I had to reboot today, for instance.

Are you detecting anything in the codes above ? Maybe I can’t see it, but I don’t. :frowning:

Maybe I ought to run journalctl just when /srv is missing, I mean today it would have been after my former boot. I wonder why no persistent journal was found, maybe something to set up ?