LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-14-2009, 10:46 PM   #1
Nagglfar
LQ Newbie
 
Registered: Mar 2009
Posts: 6

Rep: Reputation: 0
Increasing my /home directory using LVM


Increasing my /home directory
I have 4 drives in total on my system. And I want to make a logical volume which is a part of the volume group that has all 5 drive partitions. This is my disk setup:

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xc3072e18

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2611 20972826 83 Linux
/dev/sda2 2612 2734 987997+ 82 Linux swap / Solaris
/dev/sda3 2735 8814 48837600 83 Linux
/dev/sda4 8815 14593 46419817+ 83 Linux

Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000c6669

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 38913 312568641 83 Linux

Disk /dev/sdc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000c0f9b

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 2433 19543041 c W95 FAT32 (LBA)
/dev/sdc2 2434 15807 107426655 83 Linux
/dev/sdc3 15808 27966 97667167+ 83 Linux
/dev/sdc4 27967 38913 87931777+ 83 Linux

Disk /dev/sdd: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x263dac44

Device Boot Start End Blocks Id System
/dev/sdd1 1 60801 488384001 83 Linux

-------------------fstab file

# /dev/sda1
UUID=54aa38ac-e175-4979-92dd-43a4ec27ac79 / ext3 relatime,errors=remount-ro 0 1
# /dev/sdb1
UUID=b5b58938-dd30-4cda-a4fa-8afe29d34ba4 /home ext3 relatime 0 2
# /dev/sda2
UUID=806b152c-1e0d-4507-8173-1a2f7f022fa9 none swap sw 0 0



------------------output for df

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 20807184 5557868 14200676 29% /
/dev/sdb1 307663800 307663800 0 100% /home

I want my volume group to contain the 5 partitons:
/dev/sdb1
/dev/sdc2
/dev/sdc3
/dev/sdc4
/dev/sdd1

I also have a windows partition that I'm going to leave alone. I dont want to repartition any hard drive. So does anyone know the detailed commands to make a volume group that contains these partitions, so I can expand my /home directory?

Best regards
 
Old 07-15-2009, 02:07 AM   #2
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
I am going to assume that you are not already using LVM.

Before doing anything, ensure you have a backup of your current /home partition!

If you cannot backup the /home partition before creating the new LVM, then leave the device for /home out of the LVM until you can mount the new /home partition and copy the data across.

To use LVM, the first thing you need to do is prepare the devices with the pvcreate command, but this will destroy the data you have on these partitions:
Code:
pvcreate /dev/sdc2 /dev/sdc3 /dev/sdc4 /dev/sdd1
Then create a Volume Group with the vgcreate command:
Code:
vgcreate vg00 /dev/sdc2 /dev/sdc3 /dev/sdc4 /dev/sdd1
Then create your Logical Volume with the lvcreate command:
Code:
lvcreate -L 500G -n lvol1 vg00
Then you need to make your file system on the new logical volume:
Code:
mke2fs /dev/vg00/lvol1
Then, mount the new volume, copy the data, and change the /etc/fstab entry.

Once you have confirmed that all is OK, you can then delete the old /home partition and add it to the volume group (pvcreate, vgextend) for use later on.
 
Old 07-15-2009, 11:42 AM   #3
Nagglfar
LQ Newbie
 
Registered: Mar 2009
Posts: 6

Original Poster
Rep: Reputation: 0
You left /dev/sdb1 out of the commands because it's part of the /home directory, correct? I can include this partition since I've saved the /home data elsewhere.
 
Old 07-15-2009, 02:01 PM   #4
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
Yes, exactly.

I didn't want to include the existing /home partition and have you lose your data.

If you have copied this elsewhere and are happy that it is not on any of the selected partitions, you should be safe to add the /dev/sdb1 entry to the list of partitions being passed to pvcreate.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"Home directory already exists. Please enter another home directory path." Daravon Ubuntu 2 02-15-2009 10:26 PM
contents of 'home' directory found at sda5: mounted as /home, and also on sda6:/home leswatson Linux - Newbie 4 04-18-2008 04:02 PM
Active Directory User Cannot Write to Samba Home Directory jonwatson Linux - Networking 2 12-19-2006 12:40 PM
Apache Root/Home Directory and setting up FTP for home directories? Mankind75 Linux - Newbie 6 07-23-2006 02:37 PM
How to protect a file/directory in your home login directory (RH Linux) jitsenho Linux - Security 9 07-03-2006 11:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:00 PM.

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