- Stop the VM
- Run qemu-img resize vmdisk.img +10G to increase image size by 10Gb
- Start the VM, resize the partitions and LVM structure within it normally
Linux
Booting to a RAID drive from a USB key
I ran into a situation recently where I was building a new server install on a RAID controller in an old extra PC (Dell Optiplex). The BIOS in this machine wouldn’t allow a boot directly from the RAID card, but it did support booting from a USB flash drive.
My solution was to put a bootloader on the USB drive and have it load the operating system directly from the RAID logical volume.
- Boot into rescue mode from your distro’s installation DVD. I used CentOS 7 but any distro would probably be fine.
- Mount the RAID volume with your previously installed operating system using chroot /mnt/sysimage
- Once booted, insert your USB Flash Drive
- Type fdisk -l (and note which device is your USB)
- Type mkdir /mnt/USB && mount /dev/sdx1 /mnt/USB (replacing x with your actual usb device)
- Type grub-install –force –no-floppy –boot-directory=/mnt/USB/boot /dev/sdx (replacing x with your actual USB device)
- Type cd /mnt/USB/boot/grub2
- Type cp /boot/grub2/grub.cfg .
- You may need to update the grub.cfg on the USB so that the paths points to the correct location of the kernel image and initramdisk in /boot
- You should now be able to boot your operating system installed on the RAID volume off of the USB drive
Flush Postfix Mail Queue
Traditionally you use the “sendmail -q” command to flush mail queue under Sendmail MTA. Under Postfix MTA, just enter the following command to flush the mail queue:
# postfix flush
OR
# postfix -f
To see mail queue, enter:
# mailq
To remove all mail from the queue, enter:
# postsuper -d ALL
To remove all mails in the deferred queue, enter:
# postsuper -d ALL deferred
postfix-delete.pl script
Following script deletes all mail from the mailq which matches the regular expression specified as the first argument
#!/usr/bin/perl $REGEXP = shift || die "no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!"; @data = qx</usr/sbin/postqueue -p>; for (@data) { if (/^(\w+)(\*|\!)?\s/) { $queue_id = $1; } if($queue_id) { if (/$REGEXP/i) { $Q{$queue_id} = 1; $queue_id = ""; } } } #open(POSTSUPER,"|cat") || die "couldn't open postsuper" ; open(POSTSUPER,"|postsuper -d -") || die "couldn't open postsuper" ; foreach (keys %Q) { print POSTSUPER "$_\n"; }; close(POSTSUPER);
For example, delete all queued messages from or to the domain called fackspamdomain.com, enter:
./postfix-delete.pl fackspamdomain.com
Delete all queued messages that contain the word “xyz” in the e-mail address:
./postfix-delete.pl xyz
Recent Comments