LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Adding a new hard drive to my LVM (http://www.linuxquestions.org/questions/linux-newbie-8/adding-a-new-hard-drive-to-my-lvm-742714/)

simplified 07-25-2009 08:34 AM

Adding a new hard drive to my LVM
 
Hi All

I installed Ubuntu Server 9.04 on my server and I've found I'm running out of hard drive (HDD) space. Although this isn't at a critical stage yet, problems are around the corner so I thought I'd throw another 1TB disk in there for future expansion.

When I installed the system I have the entire / file system installed on a single LVM. Here's an output of of "df -H" before the installation of the second HDD:

Code:

root@dunzsvlx01:~# df -H
Filesystem            Size  Used  Avail Use% Mounted on
/dev/mapper/dunzsvlx01-root
                      980G  695G  236G  75% /
tmpfs                  910M      0  910M  0% /lib/init/rw
varrun                910M  644k  910M  1% /var/run
varlock                910M      0  910M  0% /var/lock
udev                  910M  148k  910M  1% /dev
tmpfs                  910M      0  910M  0% /dev/shm
lrm                    910M  2.7M  908M  1% /lib/modules/2.6.28-13-server/volatile
/dev/sda5              239M    29M  198M  13% /boot

So then I installed the new HDD, another 1TB. What I'm basically looking to do is to merge the new HDD into the existing lvm (/dev/mapper/dunzsvlx01-root). I've looked on a few sites and from what I can figure out there isn't a way of doing it without destroying the existing data. As the /dev/mapper/dunzsvlx01-root lvm is mounted on / this is going to trash my system.

Does anyone know of a way of moving the new HDD into the /dev/mapper/dunzsvlx01-root lvm without destroying the system?

Naturally I have a backup of /home ;-)

Any thoughts would be most appreciated... I don't want to rebuild if I can help is as that's a bit of a "windows" attitude!

TIA, Simplified

Meson 07-25-2009 09:20 AM

I don't think you can just add a physical hard drive to your logical volume group and merge it with your existing partition. If you want both disks to appear as one, you should look into RAID. (Specifically RAID 0).

Another thing you can do is just mount the TB drive onto a directory like /home/BACKUP and put some stuff on it that way (you'd have to consciously manage what data belongs on which drive.)

Also, without destroying data, you should be able to reorganize yourself a little. You could have a 64 MB /boot, a 50 GB / (both should be more than ample), a 2 GB swap. Then with the remainder of your primary drive and your secondary drive you can create a RAID 0 array for /home.

With this setup you should be able to A) Easily expand your /home drive, and B) make changes to your OS independent of your data. - you might even want another 50 GB partition along side / for use with experimental dual boots (if you wanna try out new OSs or something).

Either way you should work out some palatable backup scheme, if these are your only two drives you should make sure there is at least 1 copy of your really important stuff on each drive =)


Just out of curiosity, what do you have that's taking up so much space? (Audio/video?)

simplified 07-25-2009 10:12 AM

Quote:

I don't think you can just add a physical hard drive to your logical volume group and merge it with your existing partition. If you want both disks to appear as one, you should look into RAID. (Specifically RAID 0).

Another thing you can do is just mount the TB drive onto a directory like /home/BACKUP and put some stuff on it that way (you'd have to consciously manage what data belongs on which drive.)

Also, without destroying data, you should be able to reorganize yourself a little. You could have a 64 MB /boot, a 50 GB / (both should be more than ample), a 2 GB swap. Then with the remainder of your primary drive and your secondary drive you can create a RAID 0 array for /home.

With this setup you should be able to A) Easily expand your /home drive, and B) make changes to your OS independent of your data. - you might even want another 50 GB partition along side / for use with experimental dual boots (if you wanna try out new OSs or something).

Either way you should work out some palatable backup scheme, if these are your only two drives you should make sure there is at least 1 copy of your really important stuff on each drive =)


Just out of curiosity, what do you have that's taking up so much space? (Audio/video?)
Hi Meson

Thanks for the advice. I think that I'll go down the RAID 0 option as I was toying with that idea. I did rush into building it at Ubuntu 9.04 as originally I wanted to install CentOS 5.3 on it but I didn't like the motherboard and as such couldn't see the HDD - so at 1am I decided to install Ubuntu.

You're totally right on the partition front, I really should have separate partitions. Very naughty...

I do run regular backups on this machine using rsync to an external HDD (1TB) and just hope the technology catches up with me when I get over this size! Then it'll be a trip to the shops...

I use the server for numerous reasons:

- Samba for my work and personal data (I work from home)
- CUPS for network printing
- Virtualization
- Squid Proxy
- SSH/SCP Server
- DAAP Server

It's the virtualization that really sucks up the HDD. I find that learning an OS is a snap with VMware Server as well as good old "trial and error". I try and test software in VM's prior to installing on "live iron" so I can be sure I don't disturb anything. Plus, my work involves showing a live environment for demonstrations, so I need to run 2 VM's for that, one of which is a SIM/SEM platform which needs lots of space for logging data. I work this box hard :D

Thanks again, take it easy... Simplified

jschiwal 07-25-2009 10:18 AM

You can add a new drive to a physical volume. Your Ubuntu gui partitioner can probably do it, which might be easier.

After joining it, it will appear as empty space. You still need to grow the filesystem of your logical volumes using perhaps gparted.

If you run a webserver or fileserver, you could need a large amount of space for the directory it uses. Perhaps /srv/. (On some distro's the /var/ directory)
Having a partition (logical volume) dedicated for this purpose may be a good idea.
For workstations, a separate /home partition would make sense.

If you burn DVDs, then you want enough room on /tmp to hold your ISO images. Take that into consideration if /tmp is a directory. That will increase the amount of space you need for the root (/) filesystem. A regular users temp directory is often a symbolic link to a directory in /tmp, and this is where your burner program will create the iso image before burning.

simplified 07-25-2009 10:30 AM

Quote:

You can add a new drive to a logical volume. Your Ubuntu gui partitioner can probably do it, which might be easier.

After joining it, it will appear as empty space. You still need to grow the filesystem using gparted.
Thanks for the pointer - I'll check this out as this will work better for me than RAID 0.

As I'm running a headless server do I use these commands to runs these tools over ssh -X ?

Code:

$ sudo system-config-lvm
$ sudo gparted

Sorry to ask such a rudimentary question! :)

Meson 07-25-2009 10:30 AM

Quote:

Originally Posted by jschiwal (Post 3619894)
You can add a new drive to a logical volume. Your Ubuntu gui partitioner can probably do it, which might be easier.

After joining it, it will appear as empty space. You still need to grow the filesystem using gparted.

So LVM facilitates having 1 partition span multiple drives?

Sorry if I started you down the wrong path simplified

jschiwal 07-25-2009 11:52 AM

Meson: LVM2 has logical volumes and physical volumes. A logical volume is like a raid0 array volume. /dev/mapper/dunzsvlx01-root is a logical volume. It could be composed of several disks, or even a raid-5 array. Since no such devices are shown this isn't the case.

A physical volume would be a partition on a disk. When you select the type of filesystem in the partitioner, or fdisk, you select lvm. Then you are ready to join the physical partition to the lvm. An lvm physical volume is actually very similar to a RAID0 array, so you were suggesting something that amounted to almost the same thing.

simplified:
You can run graphical programs remotely using "ssh -X". The X server is located at the terminal and not on the server. The server can be running in non-graphical mode. If the server has the GUI programs installed, a base Xorg system would probably be installed as dependencies. If not, there are not GUI programs to run on the server anyway, so the point is moot.

However, if you will be growing a system partition (/) that can't be unmounted, then you will need to grow the partition offline. The filesystem has to be unmounted. If this is the case, you probably want to run it off a live distro. You could ssh into the server that is running off a live distro, if this server doesn't have any graphics card you can use temporarily.

You would most likely need to power down the server to install a drive anyway.

Be sure to read the manpages for the lv* and pv* programs, which work with physical and logical volumes. The "/sbin/vgmknodes" program may be needed to create the device nodes for your volume group.

simplified 07-25-2009 12:01 PM

Quote:

Originally Posted by Meson (Post 3619901)
So LVM facilitates having 1 partition span multiple drives?

Sorry if I started you down the wrong path simplified

No worries dude :D

simplified 07-25-2009 12:03 PM

Cheers!
 
Quote:

Originally Posted by jschiwal (Post 3619972)
Meson: LVM2 has logical volumes and physical volumes. A logical volume is like a raid0 array volume. /dev/mapper/dunzsvlx01-root is a logical volume. It could be composed of several disks, or even a raid-5 array. Since no such devices are shown this isn't the case.

A physical volume would be a partition on a disk. When you select the type of filesystem in the partitioner, or fdisk, you select lvm. Then you are ready to join the physical partition to the lvm. An lvm physical volume is actually very similar to a RAID0 array, so you were suggesting something that amounted to almost the same thing.

simplified:
You can run graphical programs remotely using "ssh -X". The X server is located at the terminal and not on the server. The server can be running in non-graphical mode. If the server has the GUI programs installed, a base Xorg system would probably be installed as dependencies. If not, there are not GUI programs to run on the server anyway, so the point is moot.

However, if you will be growing a system partition (/) that can't be unmounted, then you will need to grow the partition offline. The filesystem has to be unmounted. If this is the case, you probably want to run it off a live distro. You could ssh into the server that is running off a live distro, if this server doesn't have any graphics card you can use temporarily.

You would most likely need to power down the server to install a drive anyway.

Be sure to read the manpages for the lv* and pv* programs, which work with physical and logical volumes. The "/sbin/vgmknodes" program may be needed to create the device nodes for your volume group.

Thanks - will do, appreciate the help!


All times are GMT -5. The time now is 03:14 AM.