LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-24-2007, 12:05 AM   #1
gargvipul
LQ Newbie
 
Registered: Nov 2007
Posts: 3

Rep: Reputation: 0
Smile Steps to increase /home partition to new hard disk


I have my Linux server disk configuration as follows:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.7G 2.7G 6.5G 30% /
none 1013M 0 1013M 0% /dev/shm
/dev/sda2 51G 45G 4.4G 92% /home
/dev/sda3 4.9G 42M 4.6G 1% /tmp

I wish to increase the partition size of /home to a new disk space. I wish to know the steps in detail to achieve the desired result.

The /home partition has my database and application stored and wish to be intact while increasing the partition. In case I need to take a backup then do let me know the command to achieve the desired backup.

Warm regards,
Vipul
 
Old 11-24-2007, 01:04 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You only need to create a partition & file system on the new disk and mount it under a temporary name like /home-new and copy the files. Use the "-a" archive option. You could also use the tar command. The info manual has an example of copying a partition.

Another thing you might consider is creating an LVM volume of the new drive. Then create a /home-new partition on the volume and copy the files over. If the files copy over fine, you can edit your /etc/fstab file to mount the LVM volume on /home instead. Later you can add /dev/sda2 to the volume and increase your new /home by 45G if you wished.

Last edited by jschiwal; 11-24-2007 at 01:05 AM.
 
Old 11-24-2007, 01:22 AM   #3
gargvipul
LQ Newbie
 
Registered: Nov 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you for the suggestion. I essentially understand from your suggestion that the existing /home partition data need to be copied to the new disk using cp or tar command. Is there any possibility to increase the partition size without copying the data, that is, adding the new disk space to existing /home partition.

Also I would like to know that I have Oracle database installed in /home partition. Will copying the data to the new disk maintain the database integrity.
 
Old 11-24-2007, 02:46 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I misread "new disk space" as "new disk". If the next partition is temp, you could recreate it, moving the start of the partition up, leaving room to grow the home partition.

I would recommend backing up the data in any case. I think the best way to do that is to use an external drive formatted in a Linux filesystem. Then either copy the files over or use tar to create a tarball. It would be best if the /home partition were off line. That way files won't be altered when copying them over. Some distro's have a partitioner program that can expand the filesystem without losing data, but you want to back up the contents just in case.
 
Old 11-24-2007, 05:25 AM   #5
gargvipul
LQ Newbie
 
Registered: Nov 2007
Posts: 3

Original Poster
Rep: Reputation: 0
You read it correctly. It is new disk, that is, additional disk. I was curious to know that can a partition span to multiple disks or not. For example in my case the /home has 51GB space on disk1. I want the /home partition to increase by 140GB on disk2.

That is, /home = 51GB on disk1 + 140GB on disk2. Is such scenario possible?
 
Old 11-24-2007, 09:30 PM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Yes, that is what LVM does. You can add new disks to an LVM volume. In your /etc/fstab file, insead of a disk partition device like (/dev/sda2), you will use the LVM device name.
example from Fedora Core 6 Laptop:
Code:
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
This laptop has a single partition for the system (/); /home is a directory.
Fedora core uses LVM by default. It has a graphical LVM manager to add disks to an LVM volume. On SuSE, you can do the same thing using their partitioner program. You can also do it from the console. The first step would be installing the LVM package. Read the README and any howto's installed with the package. The LVM package installs several programs. For example, suppose you had a 10GB disk. You want to replace it with an 80GB disk. You could migrate the contents from the 10GB volume member, remove it from the volume, replace it with the 80GB disk, and add that one to the volume.

I'm not certain whether you can add the old /home partition nondestructively. In my first post I suggested creating an LVM volume, and mounting it as /home-new. Then copy the contents over from /home to /home-new. Now you can edit /etc/fstab and mount the LVM volume (it using the new disk(s)) as /home. You can use the old space from the old /home partition and add it to the volume. So now the LVM volume consists of the new disks plus the partition you were using previously for /home.

Last edited by jschiwal; 11-25-2007 at 03:45 AM.
 
  


Reply


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
How can i increase hard disk space cyrilbritto Linux - Hardware 5 08-26-2011 07:15 AM
Increase a new HD to the 1st HD Partition /home ? prixone Linux - Server 8 07-30-2007 10:24 PM
increase space on /home partition v1nc3nt Linux - Newbie 1 10-11-2006 03:56 AM
how to increase the size of home partition srnerkar1 Linux - Software 1 12-05-2005 05:28 AM
Knoppix to hard disk: complete steps jfchui Linux - Newbie 2 04-17-2004 04:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration