When I run
ls command for some directories, it may take about 1.5 seconds to complete even if directory has just a few files, but for most of directories it's very fast. It seems that it's slow for directories which I didn't access for a long time, but maybe it's not related. When I repeat this command for same directory it always run fast.
This command is slow only for directories on
/home mount point, for all other partition on same volume it's fast.
~/backups dir contains just 3 files, here is output for 2 runs:
$ time ls ~/backups # file list real 0m1.635s user 0m0.001s sys 0m0.000s $ time ls ~/backups # file list real 0m0.001s user 0m0.001s sys 0m0.000s
/home is formatted in
ext4 fs, it's a
lvm2 partition encrypted with
LUKS, the volume is a HDD "WDC WD10SPZX-75Z".
fstab line for
/dev/mapper/home /home ext4 defaults,noatime 0 0
Is it possible to improve IO performance in my case?
UPDATE: it's not only
ls command, but all io operations, e.g.
touch command is also slow when I try to modify directories which I didn't access for a long time.
UPDATE2: the output of
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 931.5G 0 disk ├─HDD-root 254:3 0 32G 0 lvm ├─HDD-var 254:4 0 256G 0 lvm │ └─var 254:8 0 256G 0 crypt /var └─HDD-home 254:5 0 512G 0 lvm └─home 254:7 0 512G 0 crypt /home
TARGET SOURCE FSTYPE OPTIONS / /dev/mapper/root ext4 rw,relatime,commit=600 ├─/proc proc proc rw,nosuid,nodev,noexec,relatime │ └─/proc/sys/fs/binfmt_misc binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime ├─/dev udev devtmpfs rw,nosuid,relatime,size=10240k,nr_inodes=2013980,mode=755 │ ... (some /dev related mount points) ├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime │ ... (a lot of /sys and cgroups mount points) ├─/run tmpfs tmpfs rw,nodev,relatime,size=1612028k,mode=755 │ └─/run/user/1000 none tmpfs rw,relatime,mode=700,uid=1000 ├─/home /dev/mapper/home ext4 rw,noatime,commit=600 │ └─/home/projects /dev/mapper/projects ext4 rw,relatime,discard,commit=600 ├─/var /dev/mapper/var ext4 rw,relatime,commit=600 └─/tmp tmpfs tmpfs rw,nosuid,nodev,noatime,size=4194304k