LVM – moving data to new PV within Logical Volume

We are moving live system (with running services) in LVM from RAID device /dev/md2 to newly created RAID device /dev/md4.

parted -a optimal -s /dev/nvme0n1 mklabel gpt
parted -a optimal -s /dev/nvme1n1 mklabel gpt
parted -a optimal -s /dev/nvme0n1 mkpart primary 1MiB -1
parted -a optimal -s /dev/nvme1n1 mkpart primary 1MiB -1
mdadm --create /dev/md4 --metadata=default --level=raid1 \
--raid-devices=2 /dev/nvme0n1p1 /dev/nvme1n1p1
pvcreate /dev/md4
vgextend vg01 /dev/md4
partprobe /dev/nvme1n1
partprobe /dev/nvme0n1
pvmove /dev/md2 /dev/md4
vgreduce vg01 /dev/md2
pvremove /dev/md2
mdadm --stop /dev/md2
lvresize -l '80%VG' vg01/lvroot
resize2fs /dev/vg01/lvroot
mdadm --detail --scan | grep md4 >> /etc/mdadm/mdadm.conf
update-initramfs -u

Audio conversions (FLAC, APE, mp3, WAV, OGG) and splitting using cue files.

Install all necessary packages: mac lame vorbis-tools flac cuetools shntool.

.wav to .flac:
$ flac -8 input.wav -o output.flac

.flac to .wav:
$ flac -d input.flac -o output.wav

.wav to .mp3:
$ lame -b 192 input.wav output.mp3

.flac to .ogg:
$ oggenc -q 10 input.flac -o output.ogg

.wav to .ogg:
$ oggenc -q 10 input.wav -o output.ogg

.ape to .wav:
$ mac input.ape output.wav -d

split:
$ cuebreakpoints list_file.cue | shnsplit input.flac
$ cuebreakpoints list_file.cue | shnsplit input.wav

You can’t split .ape!