[SOLVED] LVM with EXT4 - Slow to boot, slow to write (actually bad WD500 HDD)
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
LVM with EXT4 - Slow to boot, slow to write (actually bad WD500 HDD)
(EDIT: I was attempting to migrate my desktop to a Western Digital WD500AADS Green drive. The drive is the cause of the slowness. I ended up using an ancient Seagate ST3400620AS HDD and their is no delays or slowness.)
My 1st attempt at LVM formatted with ext4 on a desktop. Was hoping to learn LVM and migrate my servers to LVM before adding more HDDs but I have much to learn.
Running UEFI to EFI boot partition then mount LVM with swap, / and /home in separate logical volumes. Boot time to login has increased a lot after initrd passes control to the HDD (5 minutes or more) which is crazy. The HDD can show active every 5 seconds with a system freeze for many seconds (sometimes more than a minute) until the HDD calms down.
Originally I mounted the logical volumes with defaults then found changing the commit=60 helped (default is commit=5). That is just a temporary workaround to help reduce the system freezes when the HDD is busy but increases the risk of data loss should the system lock or go through an ungraceful shutdown.
I'm humbled at not being able to figure this out. I expected a little extra overhead but not something as noticeable as I'm experiencing.
What am I missing? The writes can't be this painful in a properly setup LVM config. I need help, my Google-foo is weak!
Code:
bash-4.3# gdisk -l /dev/sdb
GPT fdisk (gdisk) version 1.0.0
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 08707F74-C664-4C02-B711-7CE2B702203A
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 206847 100.0 MiB EF00
2 206848 976773134 465.7 GiB 8E00
bash-4.3#
bash-4.3# pvdisplay
--- Physical volume ---
PV Name /dev/sdb2
VG Name vg2
PV Size 465.66 GiB / not usable 3.01 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 119209
Free PE 0
Allocated PE 119209
PV UUID 1buaER-WTxN-ncSn-kwnq-fBtO-JL0n-nspMrw
bash-4.3#
Code:
bash-4.3# vgdisplay
--- Volume group ---
VG Name vg2
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 10
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 465.66 GiB
PE Size 4.00 MiB
Total PE 119209
Alloc PE / Size 119209 / 465.66 GiB
Free PE / Size 0 / 0
VG UUID bGPv1c-C8JA-uiLX-px0E-39iQ-KTuC-v38419
bash-4.3#
Code:
bash-4.3# lvdisplay
--- Logical volume ---
LV Path /dev/vg2/lv1
LV Name lv1
VG Name vg2
LV UUID ojrsZy-7jT1-p3z0-UzQL-tGPy-HC4x-MeQmGL
LV Write Access read/write
LV Creation host, time slacker, 2016-05-11 09:37:00 -0600
LV Status available
# open 2
LV Size 8.00 GiB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/vg2/lv2
LV Name lv2
VG Name vg2
LV UUID qT3Gu0-TZ7E-Yv9F-b0Mc-eXN6-ZENw-wF8n2Q
LV Write Access read/write
LV Creation host, time slacker, 2016-05-11 09:37:44 -0600
LV Status available
# open 1
LV Size 16.00 GiB
Current LE 4096
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/vg2/lv3
LV Name lv3
VG Name vg2
LV UUID dZmP2F-Zsns-X57c-fW1K-9QIn-g4uQ-dUOWm0
LV Write Access read/write
LV Creation host, time slacker, 2016-05-11 09:38:37 -0600
LV Status available
# open 1
LV Size 441.66 GiB
Current LE 113065
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
bash-4.3#
Yes, that's what I was thinking. Perhaps the gdisk and LVM utilities used by the OP are old versions and don't allow for optimal alignment, although the gdisk output doesn't show anything amiss.
I'm running an HP-635 with -current and an SSD. This machine is BIOS only. I'm running LVM on top of LUKS and my boot times are much less than 5 minutes. (I don't know how long, just that I'm not annoyed by how long it is taking.)
What's confusing is that this desktop was running without issue on 4 standard GPT partitions prior to LVM. It has 8GB RAM and rarely uses any of the 8GB swap. Currently other than the 100MB EFI partition the entire drive is allocated to LVM and filled with a single volume group with 3 logical volumes, 1 x swap and 2 x ext4. I'm hoping that it's something identifiable like a drive alignment issue, something I can ferret out and correct. I'm just stumped after tinkering with this for the last 5 days.
Do you use a generic kernel with an initrd or some other setup?
I use the generic kernel with an initrd. I added device mapper support to the initrd with the "-L" option. In addition when I formatted the ext4 logical partition to ext4 with mkfs I used "-E lazy_journal_init=0" to fully create the journal during the format process so it wasn't written later.
More ext4 data on the / logical partition.
Code:
bash-4.3# tune2fs -l /dev/mapper/vg2-lv2
tune2fs 1.42.13 (17-May-2015)
Filesystem volume name: <none>
Last mounted on: /
Filesystem UUID: bd4aa6ae-62c1-417c-9243-49e6912c321e
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags: signed_directory_hash
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 1048576
Block count: 4194304
Reserved block count: 209715
Free blocks: 1267256
Free inodes: 631600
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 1023
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
Flex block group size: 16
Filesystem created: Wed May 11 09:55:32 2016
Last mount time: Tue May 17 07:04:18 2016
Last write time: Tue May 17 07:04:18 2016
Mount count: 4
Maximum mount count: -1
Last checked: Sun May 15 10:43:26 2016
Check interval: 0 (<none>)
Lifetime writes: 16 GB
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Required extra isize: 28
Desired extra isize: 28
Journal inode: 8
First orphan inode: 803276
Default directory hash: half_md4
Directory Hash Seed: 3c664b9c-467a-4f56-b370-8dffc72a21f3
Journal backup: inode blocks
bash-4.3#
Why did you change the commit value ?. Did you have data that led you to do that ? - if so let's see it.
So far you have presented zero performance data. No data, no way for anyone to sensibly assist. Historical data is best as it can be queried ad nauseum - iostat, collectl, dstat, whatever. If you don't have any, install (at least) one and collect data for a few days.
Why did you change the commit value ?. Did you have data that led you to do that ? - if so let's see it.
So far you have presented zero performance data. No data, no way for anyone to sensibly assist. Historical data is best as it can be queried ad nauseum - iostat, collectl, dstat, whatever. If you don't have any, install (at least) one and collect data for a few days.
I changed the commit value because I was seeing longer than usual HDD disk activity lights and freezes every 5 seconds. My Google searches showed others ran into the same delays so I thought it was worth a try. I'll reset the commit value to default and give one of your performance data suggestions time to collect info. I hope that helps isolate what I'm seeing. Thanks for your help.
Hmm. Maybe you aren't lucky. What does smartctl say about the status of your drives' health? (IOW, one or more of your drives may have decided to start failing just after you switched to LVM.)
Hmm. Maybe you aren't lucky. What does smartctl say about the status of your drives' health? (IOW, one or more of your drives may have decided to start failing just after you switched to LVM.)
Good thought, smartctl shows aging of the drive but no errors on both the short and long tests.
I created a new test user and after login I couldn't get that new user to show the slow downs or freezes. I suspect my KDE user files need a freshening up after the last few upgrades on -current plus numerous application installs that probably need recompiling.
I'm going to recreate my user files and rebuild critical user applications. I'll mark the thread a solved for now.
Looks like I've narrowed down the issue after boot. Thanks syg00! I installed dstat from Slackbuilds and it showed a lot of dkdeinit4 & Xorg entries.
It's a strange solution, given the slowdown occurred early on in the boot sequence, before KDE and Xorg were started. "Boot time to login has increased a lot after initrd passes control to the HDD (5 minutes or more)", in your own words. That's quite a bit earlier than a login prompt, so it is mystifying how user config files could have been the cause. I'm curious to know as well how you migrated your "numerous application installs" to LVM in the first place.
Last edited by Gerard Lally; 05-18-2016 at 06:35 PM.
My thinking too. very strange. Perhaps the description didn't really explain the real situation - for example I have a much narrower definition of "boot" than most people. And it doesn't include init or anything there-after.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.