Creating LVM Virtual Drives

driveicons

Now that we have a raid array created, we are going to create some virtual drives. Why virtual drives? Well, we have one large terabyte drive right now, and if we just put folders in there, it can quickly get cumbersome. You have no control on size of those folders, and permissions can be more difficult. And if you try to share this drive, you can’t assign different drive letters in windows to different folders, just one to the drive. One other issue is file system. I am going to use just a basic file system here, but in the past I have created different file systems based on the type of use ie. large video files, small text files, etc. Making those decisions is beyond the scope of this tutorial, and I have decided that for my purposes now, it doesn’t matter that much. You can decided differently.

What we will discuss is using LVM. This enables you to set up virtual drives that can contain different file systems, and that can be grown and shrunk (usually) to fit the space needs of the system. We will look at maintenance of these file systems at a later tutorial. Here we will create a backup, and a pictures virtual drive. We will not use the full terabyte of space, so that we can grow these as needed, or add another for say music at another time.

I will once again be doing this on an ubuntu system, but the use of these tools is fairly standard across linux distributions.
Continue reading

Setting up Linux Software Raid

This entry is part 3 of 3 in the series Building a NAS

Dual Drives for Raid 1This is part of our series on building a NAS. In this article we will get the box set up with a static IP address, and get your drives set up for RAID 1.

We are assuming that at this point you have Ubuntu installed. We are gong to install software raid in a moment. The first thing I want to do is make sure we have a static ip address. Usually Ubuntu will start up with a dynamic ip address. This can make it more difficult to transfer files to this box, so lets make it static.
Continue reading

Resizing a logical volume

I backup my photos from an iMac to a Ubuntu linux box with a simple rsync command.

rsync --exclude=".*" -ave ssh /my/masters userId@x.x.x.y:/media/pictures

This will copy everything new from /my/masters to the backup machine at /media/pictures without copying any “dot” files. This also does not delete anything from the new machine.

Anyway, I was doing the rsync, but ran out of space on the backup box. A ctrl-z, and now I need to make more space. I am running ext3, so it should be just a few commands. First I unmounted (umount) the filesystems just to be sure. Then :

lvextend -L +40G /dev/vg/pictures

This will grow the logical volume by 40 gig. Next we need to resize the filesystem to fill up the space.

resize2fs /dev/vg/pictures

I have done this before, but this time I got a message to run e2fsck first.

e2fsck -f /dev/vg/pictures

This finished without issue, and I then ran the resize2fs command and it finished after a couple of minutes. Remount the filesystem, a “df” and it confirms that there is more space available.

I removed the last file copied to make sure it wasn’t wrecked somehow, and then kicked off the rsync again. It just picked up where it left off.

New storage needed.

I am getting tired of my linux based setup. It just doesn’t work well enough. The biggest issue I have is that everytime it gets powered down (vacation, storm, etc) and comes back up, it doesn’t quite. I always have to execute some command line magic to get everything recognised. I have tried Gentoo, Ubuntu, Mythbuntu, all with the same issue. I think it is the add in SATA card I have in there, but I don’t want to swap out more computer hardware this time.

Continue reading