LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-25-2009, 07:34 AM   #1
simplified
Member
 
Registered: May 2007
Location: London, UK
Distribution: Kubuntu 9.04 x64 / Ubuntu Server 9.04 x64
Posts: 50

Rep: Reputation: 15
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
 
Old 07-25-2009, 08:20 AM   #2
Meson
Member
 
Registered: Oct 2007
Distribution: Arch x86_64
Posts: 606

Rep: Reputation: 66
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?)

Last edited by Meson; 07-25-2009 at 08:23 AM.
 
Old 07-25-2009, 09:12 AM   #3
simplified
Member
 
Registered: May 2007
Location: London, UK
Distribution: Kubuntu 9.04 x64 / Ubuntu Server 9.04 x64
Posts: 50

Original Poster
Rep: Reputation: 15
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

Thanks again, take it easy... Simplified
 
Old 07-25-2009, 09:18 AM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
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.

Last edited by jschiwal; 07-25-2009 at 09:36 AM.
 
Old 07-25-2009, 09:30 AM   #5
simplified
Member
 
Registered: May 2007
Location: London, UK
Distribution: Kubuntu 9.04 x64 / Ubuntu Server 9.04 x64
Posts: 50

Original Poster
Rep: Reputation: 15
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!
 
Old 07-25-2009, 09:30 AM   #6
Meson
Member
 
Registered: Oct 2007
Distribution: Arch x86_64
Posts: 606

Rep: Reputation: 66
Quote:
Originally Posted by jschiwal View Post
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
 
Old 07-25-2009, 10:52 AM   #7
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
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.
 
Old 07-25-2009, 11:01 AM   #8
simplified
Member
 
Registered: May 2007
Location: London, UK
Distribution: Kubuntu 9.04 x64 / Ubuntu Server 9.04 x64
Posts: 50

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Meson View Post
So LVM facilitates having 1 partition span multiple drives?

Sorry if I started you down the wrong path simplified
No worries dude
 
Old 07-25-2009, 11:03 AM   #9
simplified
Member
 
Registered: May 2007
Location: London, UK
Distribution: Kubuntu 9.04 x64 / Ubuntu Server 9.04 x64
Posts: 50

Original Poster
Rep: Reputation: 15
Thumbs up Cheers!

Quote:
Originally Posted by jschiwal View Post
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!
 
  


Reply

Tags
drive, expand, extend, hard, harddrive, lvm


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a drive to existing lvm fakie_flip Linux - Software 2 04-08-2008 03:52 AM
Adding a Physical Drive to an LVM System Linux31 Linux - Hardware 2 06-14-2007 06:06 PM
Using LVM and adding a drive reeseslover531 Fedora 3 09-30-2006 11:03 AM
LVM - adding a new scsi hard disk ddaas Red Hat 1 07-28-2005 02:13 AM
Adding drive with LVM DBabo Linux - Software 2 06-11-2005 10:06 PM


All times are GMT -5. The time now is 11:29 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration