LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Trying to understand LVM. (https://www.linuxquestions.org/questions/linux-newbie-8/trying-to-understand-lvm-677562/)

arashi256 10-19-2008 08:34 AM

Trying to understand LVM.
 
I'm running out of disk space on my server, so was going to add a new IDE hard disk. Presumably, each drive like hard disks are listed under the virtual filesystem under /dev. I only have one hard disk in there at the moment and I bascally want to add a new hard disk and only append the new space to /home. However, under /dev where I was expecting just one entry for /dev/sda1, I get sda, sda1 and sda2 which look like SATA drives (which I don't understand). These entries are highlighted in yellow and if I do a "ls -la" I get things like: -

cdrom (in blue) -> sr0 (in yellow)
cdrw (in blue) -> sr0 (in yellow)
floppy (in blue) -> fd0 (in yellow)

How will I know if I've added a new hard disk and how can I identify the devices above in any certainty?

As far as I can tell, the procedure for adding a new disk is: -

1. Add new physical drive (data and power cable)
2. Check to see if the new device appears under /dev (this is one bit I'm unclear about).
3. fdisk the new disk using "fdisk /dev/sda2" or whatever (thats what I need to know too, I guess).
4. Format the Linux partition using "mkfs -t ext3 /dev/sda2".
5. Scan for Linux LVM file-systems which the "vgcreate <groupname> /dev/partition1...or something". Don't understand this bit either really.
6. Create volumes to a specific set with the "pvcreate /dev/partition1" command.
7. Now I should be able to create a logical volume (presumably something like VolGroup01 like I can see under /dev now). Apparently, I should use "lvcreate -L xyM -n <volume> <group>" where xy is the size of the group and <group> is the volume group name (something like VolGroup02?) and <volume> is the name returned from the previous step.
8. Finally, format the logical volume (VolGroup02) with "mkfs -t ext3 /dev/sda2" (again? - didn't I do that already above - wrong order?)

Now, can I mount the new drive and append the space with something like "mount /dev/hda2 /home" and if so, how can I make this automatic?

Anything I've got wrong above. Oh, and sorry for all the questions! :)

mazhar_theone 10-19-2008 10:38 AM

Quote:

Originally Posted by arashi256 (Post 3315489)
I'm running out of disk space on my server, so was going to add a new IDE hard disk. Presumably, each drive like hard disks are listed under the virtual filesystem under /dev. I only have one hard disk in there at the moment and I bascally want to add a new hard disk and only append the new space to /home. However, under /dev where I was expecting just one entry for /dev/sda1, I get sda, sda1 and sda2 which look like SATA drives (which I don't understand). These entries are highlighted in yellow and if I do a "ls -la" I get things like: -

cdrom (in blue) -> sr0 (in yellow)
cdrw (in blue) -> sr0 (in yellow)
floppy (in blue) -> fd0 (in yellow)

How will I know if I've added a new hard disk and how can I identify the devices above in any certainty?

As far as I can tell, the procedure for adding a new disk is: -

1. Add new physical drive (data and power cable)
2. Check to see if the new device appears under /dev (this is one bit I'm unclear about).
3. fdisk the new disk using "fdisk /dev/sda2" or whatever (thats what I need to know too, I guess).
4. Format the Linux partition using "mkfs -t ext3 /dev/sda2".
5. Scan for Linux LVM file-systems which the "vgcreate <groupname> /dev/partition1...or something". Don't understand this bit either really.
6. Create volumes to a specific set with the "pvcreate /dev/partition1" command.
7. Now I should be able to create a logical volume (presumably something like VolGroup01 like I can see under /dev now). Apparently, I should use "lvcreate -L xyM -n <volume> <group>" where xy is the size of the group and <group> is the volume group name (something like VolGroup02?) and <volume> is the name returned from the previous step.
8. Finally, format the logical volume (VolGroup02) with "mkfs -t ext3 /dev/sda2" (again? - didn't I do that already above - wrong order?)

Now, can I mount the new drive and append the space with something like "mount /dev/hda2 /home" and if so, how can I make this automatic?

Anything I've got wrong above. Oh, and sorry for all the questions! :)

/dev/sda is your first hard drive and /dev/sda1 /dev/sda2 are partitions on it.

you should get /dev/sdb or /dev/hdb if your secondary hard drive is properly detected on your machine.

login as root and check all the drives using fdisk -l command

It will show all drives attached on your machine with the partition list .

let me know output of following command
Quote:

fdisk -l
Mazhar
http://mazhar.co.in/blogs/

arashi256 10-19-2008 10:42 AM

Quote:

Originally Posted by mazhar_theone (Post 3315597)
/dev/sda is your first hard drive and /dev/sda1 /dev/sda2 are partitions on it.

you should get /dev/sdb or /dev/hdb if your secondary hard drive is properly detected on your machine.

Ah, okay - so the numerics are partitions of the drives. Good to know - that makes more sense.

Quote:

Originally Posted by mazhar_theone (Post 3315597)
/
login as root and check all the drives using fdisk -l command

It will show all drives attached on your machine with the partition list .

let me know output of following command


Mazhar
http://mazhar.co.in/blogs/

The output with currently one hard disk is: -

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

Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 14593 117017460 8e Linux LVM

Disk /dev/dm-0: 119.2 GB, 119252451328 bytes
255 heads, 63 sectors/track, 14498 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 536 MB, 536870912 bytes
255 heads, 63 sectors/track, 65 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x30307800

Disk /dev/dm-1 doesn't contain a valid partition table

uncle_philip 10-20-2008 12:14 AM

assume your ide drive in C,
fdisk /dev/hdc, create some partition
mkfs -t ext3 /dev/hdc1, format drive c1,c2,c3..
mkdir /media/hdc1, create the mount point directory, c1,c2,c3..
mount -t ext3 /dev/hdc1 /media/hdc1, mount the drive, you need to mount the drive everytime you reboot your computer.
OR, under /etc/fstab, add
/dev/hdc1 /media/hdc1 ext3 defaults 1 1

arashi256 10-20-2008 01:17 AM

Thanks! That should give me a better direction.


All times are GMT -5. The time now is 07:13 AM.