Codecs

It’s amazing how much better a/v streaming and editing can be when you don’t make a mess of your installed codecs.

Pro Tip: Pick a codec pack and stick with it EXCLUSIVELY. You should only install other codecs/packs if there is NO OVERLAP between them, because they conflict with each other and give you heartburn.

On Windows, I recommend the K-Lite Codec Pack (“Standard” if you just play media; “Mega” if you edit media). It also comes with a killer codec tweak/fix tool, which saved my bacon.  I’ve been told that on Mac, VLC brings in the best set of codecs.  But I have no experience with this on Macs.

I was having major visual issues playing home videos in VLC on my new Windows 8.1 workstation.  I thought it was VLC choking on poor bandwidth to my media server, even though Plex played the same videos in a browser just fine.  The K-Lite Codec Tweak Tool helped identify the problem: broken x264 codecs, caused by a conflict.  So I removed the DivX codec pack and a couple other off-brands I was trying out, and re-installed the K-Lite Codec Mega Pack.

Voila!  All became good in the world again.

Now I just need to check if that was the problem with some videos I was having troubles encoding a few weeks ago.

Add Space to LVM

The Layers of LVM (Non-RAID) Reviewed

  • Start with a physical storage device.
  • On a storage device, we create a partition of type 8e (Linux LVM).
  • On a partition, we create a Physical Volume.
  • One or more Physical Volumes are grouped together into a Volume Group.
  • On a Volume Group, we create one or more Logical Volumes.
  • On a Logical Volume, we create a file system (or volume).
  • A volume is mounted at a mount point in the Linux file system.

Expand an Existing Volume

Your root (/) volume is nearly out of space and you’ve done all you can to get clear out excess data and logs.  You can expand the root volume while the server is on line and without any impact to the running applications.  If you haven’t kept up with the Linux updates, you mayhave to reboot a few times through this process.

For our example, we’re expanding the root (/) volume.

Add Raw Storage to the Server or VM

Assign a new virtual disk, extend an existing virtual disk, add physical disks, extend a LUN, add a LUN, whatever it is you need to do to get more raw storage on your server.  As you can see, this could take place in many forms.  It’s up to you and your environment how it’s done.

Make the Server Recognize the New Storage

In RedHat and CentOS, you need to install the sg3_utils package, which provides a tool called “rescan-scsi-bus.sh”.  This nifty little script identifies new storage devices and makes them available without having to reboot the server.  There are other less friendly ways of making the server recognize new storage, but this is so easy, it’s the only one I use or think about.

yum install sg3_utils

Now scan for the new storage.

rescan-scsi-bus.sh

You’ll get a bunch of output as the script runs, that attempts to tell you what devices are OLD (current) and which are NEW.  Hopefully you see one that says it’s NEW.  If not, you may have to reboot the server.

Identify the New Storage Device

You need to know the device name of the new storage so you can do stuff to it.

fdisk -l

The new device usually shows up as the last one in the output.  In any case, it’s the one with unused space, assuming you don’t have other devices with unused space.  You may need to be familiar with the current storage devices in order to identify the new one if it’s not the last one listed.

For our example, /dev/sdb is the new storage device.

Create an LVM Partition on the New Storage Device

I use fdisk because it’s what I’ve used since 1998.  You may use whatever tool you like.  The goal is to create a partition that uses 100% of the new storage and is type 8e (Linux LVM).

Here’s how it’s done in fdisk.

Open the disk to be modified.

fdisk /dev/sdb

Create the partition.

n
p
1
<Enter>
<Enter>
t
1
8e
p
w

Here’s what all that does:

n – creates a New partition

p – identifies it as a Primary partition

1 – creates it as partition number 1

<Enter> and <Enter> – accept the default begin and end sizing parameters, using all available space

t – changes the partiton Type

8e – is the partition type Linux LVM

p – Prints (to the screen) the current partition configuration for you to review before writing the changes

w – Writes the changes to the storage device and exits fdisk

For our example, the new partition is called /dev/sdb1

Add the Storage and Expand into the Space

Create a LVM Physical Volume (PV) on our new partition.

pvcreate /dev/sdb1

Review your current mount points. (Don’t just look at the /etc/fstab file because it may have been changed since the volumes were mounted.)

mount

Make note of the volume that is mounted at /

For our example, /dev/mapper/vgroot-lvroot is the root volume.

Identify the Volume Group (VG) and Logical Volume (LV) that holds your root volume

lvdisplay

Look at the list of LVs and figure out which you need to expand.  Reference the volume name you noted above.  Make note of the LV Path, LV Name and VG Name.

For our example, we’ll use /dev/vgroot/lvroot, lvroot and vgroot, respectively.

Add the new PV to your root VG. (Also described as “Extend the VG to include the new PV.)

vgextend vgroot /dev/sdb1

Get familiar with things a little more by running a few “view” commands.  Look over the info and make sure everything looks right.

vgs
pvscan
vgdisplay

Now that the VG is bigger, we can extend the the LV into that new space.

lvextend -l +100%FREE /dev/vgroot/lvroot

Command line breakdown:

-l +100%FREE – tells lvextend to usee all free space on the VG

/dev/vgroot/lvroot – is the LV path noted above

And last, but not least, extend the file system to use all of the LV space.

resize2fs /dev/mapper/vgroot-lvroot

The resize may take a while as it is working with an online file system.  I’ve seen it take upward of 30 minutes to extend the file system 500 GB.  You can watch your disk space monitoring tool if you’re curious how it’s progressing.  The overall size of the volume slowly grows as the resize2fs operation progresses.

Create a New Volume

For our example, we’re creating a data (/data) volume.

Add Raw Storage to the Server or VM

It’s up to you and your environment how it’s done.

Make the Server Recognize the New Storage

Install the sg3_utils package

yum install sg3_utils

Scan for the new storage.

rescan-scsi-bus.sh

Identify the New Storage Device

You need to know the device name of the new storage so you can do stuff to it.

fdisk -l

For our example, /dev/sdb is the new storage device.

Create an LVM Partition on the New Storage Device

Open the disk to be modified.

fdisk /dev/sdb

Create the partition.

n
p
1
<Enter>
<Enter>
t
1
8e
p
w

For our example, the new partition is called /dev/sdb1

Add the Storage and Create a New Volume

Create a LVM Physical Volume (PV) on our new partition.

pvcreate /dev/sdb1

Create a new VG on the PV

vgcreate vgdata /dev/sdb1

Create a new LV on the VG

lvcreate -n lvdata -l 100%FREE vgdata

Command line breakdown:

-n lvdata – the Name of the LV you’re creating

-l 100%FREE – tells lvcreate to use all of the free space on the VG

vgdata – the name of the VG you’re using

Look things over for a moment.

lvdisplay

Create a file system on the new LV.

mkfs.ext3 -L Data_Volume /dev/vgdata/lvdata

Command line breakdown:

-L Data_Volume – the volume label to apply to the volume

/dev/vgdata/lvdata – the name of the volume device you’re creating a file system on (could also use /dev/mapper/vgdata-lvdata)

Update your /etc/fstab file to mount the new volume.