[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to use dmsetuup?



On 11/3/23 09:27, gene heskett wrote:
Greetings all;
As usual, the man page may as well be written in swahili. The NDE syndrome, meaning No D-----d Examples.

I have those 2 2T SSD's with a gpt partition table on both, allocated as sdc1 and sdk1, formatted to ext4, named and labeled as lvm1 and lvm2.
Temp mounted as sdc1 and sdk1 to /mnt/lvm1 and /mnt/lvm2

How do I create a single managed volume of labels lvm1 and lvm2 of these to make a single volume that I can then rsynch /home to it, then switch fstab to mount it as /home on a reboot?

If it works, I'll kill the raid10, reformat it and make it another lvm for amanda to use.

I am determined to remove the raid10 /home from the list of suspects causing my system lockups anytime a program such as OpenSCAD or digiKam, even firefox wants to write a new file to my /home partition.  This delay does not lockup the whole shebang, already open files in other workspaces seem to run at normal speeds, but opening a simple gui file requester to get where to put the file, and possibly rename it, takes anywhere from 30 seconds minimum to around 5 minutes just to draw the requester on screen. And while you are waiting, wondering if you even pressed the mouse button, there is ZERO acknowledgement the button has been pushed.  The mouse can be moved normally, but until the requester is fully drawn on screen, no other button clicks are registered.

This software raid10 worked perfectly for buster and bullseye, but its been nothing but a headache on bookworm.  And only one has tried to help, suggesting strace, but its output is so copious it overflows the 32G of main memory in this machine so I can't go back to the actual programs start with the trace. I have used it in the past, decade or more back up the log, and while it was noisy then, this is unusable.

Thanks for help with dmsetup.

Cheers, Gene Heskett.


Not LVM, but FWIW I previously had my data on 2 @ 1.5 TB HDD md RAID1 LUKS ext4 on Debian 9:

October 22, 2017

1.  Install StarTech HBA and Seagate 1.5 TB drives:

2.  Set up mdadm RAID1:

	https://raid.wiki.kernel.org/index.php/RAID_setup

	2017-10-22 22:40:19 root@po ~
	# dd if=/dev/zero of=/dev/sdb count=2048
	2048+0 records in
	2048+0 records out
	1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0689901 s, 15.2 MB/s

	2017-10-22 22:46:16 root@po ~
	# dd if=/dev/zero of=/dev/sdc count=2048
	2048+0 records in
	2048+0 records out
	1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0501681 s, 20.9 MB/s

	2017-10-22 22:55:48 root@po ~
# mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/disk/by-id/ata-ST31500341AS_redacted1 /dev/disk/by-id/ata-ST31500341AS_redacted2
	mdadm: Note: this array has metadata at the start and
	    may not be suitable as a boot device.  If you plan to
	    store '/boot' on this device please ensure that
	    your boot-loader understands md/v1.x metadata, or use
	    --metadata=0.90
	mdadm: size set to 1465007488K
	mdadm: automatically enabling write-intent bitmap on large array
	Continue creating array? yes
	mdadm: Defaulting to version 1.2 metadata
	mdadm: array /dev/md0 started.

	2017-10-22 22:57:29 root@po ~
	# mdadm --detail --scan
ARRAY /dev/md0 metadata=1.2 name=po:0 UUID=2fb7086d:ccedcd0c:b5c286e2:3eb96d45

	2017-10-22 23:00:37 root@po ~
	# mdadm --detail --scan >> /etc/mdadm/mdadm.conf

	2017-10-22 23:06:45 root@po ~
	# ll /dev/md0
	brw-rw---- 1 root disk 9, 0 2017/10/22 22:56:59 /dev/md0

	2017-10-22 23:06:48 root@po ~
	# cryptsetup luksFormat /dev/md0

	WARNING!
	========
	This will overwrite data on /dev/md0 irrevocably.

	Are you sure? (Type uppercase yes): YES
	Enter passphrase:
	Verify passphrase:

	2017-10-22 23:08:09 root@po ~
	# vi /etc/crypttab

	    md0_crypt	/dev/md0					none		luks

	2017-10-22 23:09:19 root@po ~
	# cryptdisks_start md0_crypt
	[....] Starting crypto disk...[info] md0_crypt (starting)...
	Please unlock disk /dev/md0 (md0_crypt):  ********
	[ ok rypt (started)...done.


	2017-10-22 23:14:45 root@po ~
	# mkfs.ext4 -L mirror -v /dev/mapper/md0_crypt
	mke2fs 1.43.4 (31-Jan-2017)
	fs_types for mke2fs.conf resolution: 'ext4'
	Filesystem label=mirror
	OS type: Linux
	Block size=4096 (log=2)
	Fragment size=4096 (log=2)
	Stride=0 blocks, Stripe width=0 blocks
	91570176 inodes, 366251360 blocks
	18312568 blocks (5.00%) reserved for the super user
	First data block=0
	Maximum filesystem blocks=2514485248
	11178 block groups
	32768 blocks per group, 32768 fragments per group
	8192 inodes per group
	Filesystem UUID: d9054ef2-a68d-40fd-a63c-0dbef2d27455
	Superblock backups stored on blocks:
		32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
		4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
		102400000, 214990848

	Allocating group tables: done
	Writing inode tables: done
	Creating journal (262144 blocks): done
	Writing superblocks and filesystem accounting information: done

	2017-10-22 23:16:13 root@po ~
	# mkdir /mnt/md0

	2017-10-22 23:16:18 root@po ~
	# vi /etc/fstab

	    /dev/mapper/md0_crypt				/mnt/md0	ext4		defaults			0	2

	2017-10-22 23:17:51 root@po ~
	# mount /mnt/md0

	2017-10-22 23:18:12 root@po ~
	# mount | grep md0
	/dev/mapper/md0_crypt on /mnt/md0 type ext4 (rw,relatime,data=ordered)

	2017-10-22 23:22:49 root@po ~
	# rsync -a --progress --stats root@dipsy:/mnt/i3000d/ /mnt/md0/
	receiving incremental file list
	./
	approx/
	approx/debian/
	...


    Too long, too late, too noisy -- ^C out..


October 23, 2017

1.  md0 not assemling at boot.  STFW

	https://unix.stackexchange.com/questions/210416/new-raid-array-will-not-auto-assemble-leads-to-boot-problems

    Run commands:

	dpkg-reconfigure mdadm
	update-initramfs -u

2.  Continue moving data:

	Number of files: 123,773 (reg: 109,013, dir: 14,688, link: 72)
	Number of created files: 95,179 (reg: 87,324, dir: 7,854, link: 1)
	Number of deleted files: 0
	Number of regular files transferred: 87,327
	Total file size: 807,206,168,902 bytes
	Total transferred file size: 775,906,834,780 bytes
	Literal data: 775,901,990,164 bytes
	Matched data: 4,844,616 bytes
	File list size: 2,599,972
	File list generation time: 0.001 seconds
	File list transfer time: 0.000 seconds
	Total bytes sent: 1,733,657
	Total bytes received: 776,098,128,065

sent 1,733,657 bytes received 776,098,128,065 bytes 43,856,121.93 bytes/sec
	total size is 807,206,168,902  speedup is 1.04

	2017-10-23 14:58:48 root@po ~
	# df /mnt/md0
	Filesystem             1K-blocks      Used Available Use% Mounted on
	/dev/mapper/md0_crypt 1440961520 788658044 579036820  58% /mnt/md0

	2017-10-23 14:59:03 root@po ~
	# cat /proc/mdstat
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
	md0 : active raid1 sdc[1] sdb[0]
	      1465007488 blocks super 1.2 [2/2] [UU]
	      bitmap: 0/11 pages [0KB], 65536KB chunk

	unused devices: <none>


October 23, 2017

1.  Check for mdadm/kernel timeout mismatch:

	https://raid.wiki.kernel.org/index.php/Timeout_Mismatch

	2017-10-23 19:49:29 root@po ~
	# smartctl -l scterc /dev/disk/by-id/ata-ST31500341AS_redacted1
	smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-4-amd64] (local build)
	Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

	SCT Error Recovery Control:
		   Read: Disabled
		  Write: Disabled


	2017-10-23 19:50:03 root@po ~
	# smartctl -l scterc /dev/disk/by-id/ata-ST31500341AS_redacted2
	smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-4-amd64] (local build)
	Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

	SCT Error Recovery Control:
		   Read: Disabled
		  Write: Disabled


2.  Create Perl script to set SCT ERror Recovery Control read and write
    timeouts:

	2017-10-23 20:09:04 root@po ~
	# vi /usr/local/sbin/set-md0-scterc

	#!/usr/bin/env perl
	use strict;
	use warnings;
	my @drives = qw(
	    /dev/disk/by-id/ata-ST31500341AS_redacted1
	    /dev/disk/by-id/ata-ST31500341AS_redacted2
	);
	for my $drive (@drives) {
	    my @line = (
		'/usr/sbin/smartctl',
		'-l',
		'scterc,70,70',
		$drive
	    );
	    print "+ @line\n";
	    system @line and warn $!;
	}

	2017-10-23 20:13:26 root@po ~
	# chmod +x /usr/local/sbin/set-md0-scterc

	2017-10-23 20:17:35 root@po ~
	# set-md0-scterc
+ /usr/sbin/smartctl -l scterc,70,70 /dev/disk/by-id/ata-ST31500341AS_redacted1
	smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-4-amd64] (local build)
	Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

	SCT Error Recovery Control set to:
		   Read:     70 (7.0 seconds)
		  Write:     70 (7.0 seconds)

+ /usr/sbin/smartctl -l scterc,70,70 /dev/disk/by-id/ata-ST31500341AS_redacted2
	smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-4-amd64] (local build)
	Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

	SCT Error Recovery Control set to:
		   Read:     70 (7.0 seconds)
		  Write:     70 (7cp laalaa-var-local-cvs.meta-csv po:.
laalaa-var-local-cvs.meta-csv 100% 2517KB 79.2MB/s 00:00
		
		  0 seconds)

3.  Create a crontab entry to run script at boot:

	2017-10-23 20:26:26 root@po ~
	# crontab -e -u root

	    @reboot /usr/local/sbin/set-md0-scterc

	no crontab for root - using an empty one
	crontab: installing new crontab

    Disable timeouts, verify, then do a warm reboot -- timeouts set
    for md0 drives.


David


Reply to: