Lowyat.NET Forums

Welcome Guest ( Log In | Register )

LYN wins Intel-Lenovo-Tangs Blogathon challenge. Thank you everybody!
 
RSS feedBump TopicReply to this topicStart new topicStart Poll

Outline · [ Standard ] · Linear+

> Linux LVM partitioning, need little help for little info here

dRLurve
post Jul 1 2009, 11:29 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #1


Getting Started
**

Group: Junior Member
Posts: 194
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Oct 2008







hi all,

i have little misunderstanding here and it will be great if someone can point me out. I am dealing with this LVM thingy and come across to this pvcreate,vgcreate, and lvcreate. Somehow, before we could create those partition, the disk should be in linux or linux lvm system.

==================================================
[root@XXXXXXX /]# fdisk -l

Disk /dev/sda: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 783 6185025 8e Linux LVM

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 261 2096451 83 extended

Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

Disk /dev/sdd: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdd doesn't contain a valid partition table

==================================================

Let say now i will partition it... and i reach a step :

==================================================
Command (m for help): n
Command action
e extended
p primary partition (1-4)
==================================================


Q1. What the different between extended and primary partition?
Q2. If i use extended, i cant format it as "linux lvm" or "linux" system. Why?
Q3. From Q2, is it because it was another HDD so it should formatted as primary first then only i could use "extended" space for this partition?

Please clarify abit for me. I think i miss a little bit here. Thanks. notworthy.gif notworthy.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
grub
post Jul 1 2009, 12:07 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #2


Newbie
*

Group: Junior Member
Posts: 8
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Feb 2009





QUOTE(dRLurve @ Jul 1 2009, 11:29 AM)
hi all,

i have little misunderstanding here and it will be great if someone can point me out. I am dealing with this LVM thingy and come across to this pvcreate,vgcreate, and lvcreate. Somehow, before we could create those partition, the disk should be in linux or linux lvm system.

==================================================
[root@XXXXXXX /]# fdisk -l

Disk /dev/sda: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1          13      104391  83  Linux
/dev/sda2              14        783    6185025  8e  Linux LVM

Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              1        261    2096451  83  extended

Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System

Disk /dev/sdd: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdd doesn't contain a valid partition table

==================================================

Let say now i will partition it... and i reach a step :

==================================================
Command (m for help): n
Command action
  e  extended
  p  primary partition (1-4)
==================================================
Q1. What the different between extended and primary partition?
Q2. If i use extended, i cant format it as "linux lvm" or "linux" system. Why?
Q3. From Q2, is it because it was another HDD so it should formatted as primary first then only i could use "extended" space for this partition?

Please clarify abit for me. I think i miss a little bit here. Thanks.  notworthy.gif  notworthy.gif
*



Theoretically, if you use LVM , u should get Linux LVM partition, but in practice i don't see much differences between the two.

Q1. They are the same actually. If you only uses primary partition , you are limited to 4 partitions on the physical disk. The extended partition leverages this whereby you can expand the number of partitions to about 15 partitions (inclusive of the primary). Alternative to fdisk is "parted", which i prefer the latter. You have to download parted though.

Q2. Because you only format the physical disk and not the partition on the disk. Before you use extended, you need to configure it as primary first. You may want to use parted for this.

Q3. I think my answer in 2 answers this one smile.gif



User is offlineProfile CardPM
Go to the top of the page
+Quote Post
dRLurve
post Jul 1 2009, 12:30 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #3


Getting Started
**

Group: Junior Member
Posts: 194
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Oct 2008







QUOTE(grub @ Jul 1 2009, 12:07 PM)
Theoretically, if you use LVM , u should get Linux LVM partition, but in practice i don't see much differences between the two.

Q1. They are the same actually. If you only uses primary partition , you are limited to 4 partitions on the physical disk. The extended partition leverages this whereby you can expand the number of partitions to about 15 partitions (inclusive of the primary). Alternative to fdisk is "parted", which i prefer the latter. You have to download parted though.

Q2. Because you only format the physical disk and not the partition on the disk. Before you use extended, you need to configure it as primary first. You may want to use parted for this.

Q3. I think my answer in 2 answers this one smile.gif
*



Thanks bro, i get u now.... simply say, by partitioning/format HDD using fdisk and LVM partition are two different thing?

parted? can elaborate abit more? notworthy.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Guai Guai Zai
post Jul 1 2009, 12:42 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #4


On my way
****

Group: Senior Member
Posts: 607
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Sep 2005





the biggest advantage of using LVM is you can expand or shrank your partition size. To have a better picture how LVM work, kindly refer to this link http://www.redhat.com/docs/manuals/enterpr...-lvm-intro.html

the differences between primary and extended:
- you can have max 4 primary partitions
- max 1 extended partition.

you can have 3P+1E (3 Primary + 1 Extended)



User is offlineProfile CardPM
Go to the top of the page
+Quote Post
dRLurve
post Jul 1 2009, 12:55 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #5


Getting Started
**

Group: Junior Member
Posts: 194
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Oct 2008







QUOTE(Guai Guai Zai @ Jul 1 2009, 12:42 PM)
the biggest advantage of using LVM is you can expand or shrank your partition size. To have a better picture how LVM work, kindly refer to this link http://www.redhat.com/docs/manuals/enterpr...-lvm-intro.html

the differences between primary and extended:
- you can have max 4 primary partitions
- max 1 extended partition.

you can have 3P+1E (3 Primary + 1 Extended)
*



sorry for another problem i encounter now.... i have create the pv, vg, and lv. Successfully mounted and edited /etc/fstab.
I try reboot for the first time. All fine ! can access the mount point. Then when i reboot for the second time, the error came out cant find one of the lv i created and mounted. The booting process stuck there and ask me to login for filesystem repair.

Q1. What should i do to troubleshoot it now?
Q2. It say cant find the /dev/vlg/XXX. XXX is the lv i created and mounted on /test2. So basically i assuming something wrong the partition. When i trying to access the /etc/fstab, it say only in read-only mode. I cant edit. So i cant remove the mount entry i put inside. Any help on this? Thanks thanks thanks in advance! notworthy.gif notworthy.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Guai Guai Zai
post Jul 1 2009, 03:15 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #6


On my way
****

Group: Senior Member
Posts: 607
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Sep 2005





QUOTE(dRLurve @ Jul 1 2009, 12:55 PM)
sorry for another problem i encounter now.... i have create the pv, vg, and lv. Successfully mounted and edited /etc/fstab.
I try reboot for the first time. All fine ! can access the mount point. Then when i reboot for the second time, the error came out cant find one of the lv i created and mounted. The booting process stuck there and ask me to login for filesystem repair.

Q1. What should i do to troubleshoot it now?
Q2. It say cant find the /dev/vlg/XXX. XXX is the lv i created and mounted on /test2. So basically i assuming something wrong the partition. When i trying to access the /etc/fstab, it say only in read-only mode. I cant edit. So i cant remove the mount entry i put inside. Any help on this? Thanks thanks thanks in advance!  notworthy.gif  notworthy.gif
*



hmm strange, 3nd reboot then failed? and how come u not able to write /etc/fstab??
how u configure LVM, can put ur steps here..
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
jk.cheng
post Jul 1 2009, 04:02 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #7


Getting Started
**

Group: Junior Member
Posts: 51
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Feb 2009
From: Kangar, Perlis, Malaysia






Q2:
Can u open and view the fstab file... if can then just use vi toedit and force save it... force save command whistling.gifq!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
dRLurve
post Jul 1 2009, 05:33 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #8


Getting Started
**

Group: Junior Member
Posts: 194
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Oct 2008







QUOTE(Guai Guai Zai @ Jul 1 2009, 03:15 PM)
hmm strange, 3nd reboot then failed? and how come u not able to write /etc/fstab??
how u configure LVM, can put ur steps here..
*




I done it right. All the step was 100% confirmed correct since i followed a book step by step.
I think i found the root cause. 1 of the physical volume corrupted. I mean the HDD "died". So when the /etc/fstab boot up trying to search for /dev/vlg/xxx, the error say couldn't find. Now my only problem is tht cant edit the /etc/fstab file. I tried to force edit it also cannot. It keep say the file only in read-only mode.

Q1. How could i reset the setting i done since i am not allowed to tell the kernel tht the /dev/vlg/xxx no longer exist?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
ongte
post Jul 1 2009, 08:00 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #9


Getting Started
**

Group: Junior Member
Posts: 80
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Dec 2008





Basically you are in emergency mode where the filesystem is mounted read-only.
You can fix this easily with the command:
CODE
# mount -o remount /

This will remount the root '/' filesystem to read/write.

I'd also like to add that LVM does need to use a partition If you are using the entire disk as a PV, you can simple make the raw unpartitioned disk as PV, something like:
CODE
# pvcreate /dev/sdb /dev/sdc /dev/sdd


You only need to make LinuxLVM partitions if you are not using the whole disk for LVM. (such as on your /dev/sda)


Added on July 1, 2009, 8:36 pmI'd like to help clarify your initial question about partitions. Apologies upfront for the length.

When the msdos partition table was first invented, it only allowed the creation of 4 partitions.
These became known now as Primary partitions. (You can have only 4)

Later on, to overcome this limitation, a new type of partition called an Extended partition was invented. This was not an actual partition but is actually just a container designed to extend the limitation of the msdos partition table & allow for many more (logical) partitions.

You can have only 1 Extended partition & it must take the place of 1 of the Primary partitions.It should also take up all the free space on the disk. (This is because Logical partitions will be created inside the Extended partition container)

So a typical disk layout on Linux would look like this:
Total Cylinders on Disk = 4866
/dev/sda1 - Primary - Cylinder 1-398 - Linux Swap
/dev/sda2 - Primary - Cylinder 399-1021 - Mounted on /
/dev/sda3 - Primary - Cylinder 1022-2083 - Mounted on /home
/dev/sda4 - Extended - Cylinder 2084-4866 - Extended Container
/dev/sda5 - Logical - Cylinder 2084-3142 - Mounted on /usr
/dev/sda6 - Logical - Cylinder 3143-4866 - Mounted on /var

Notice that the Cylinder start for sda4 & sda5 is the same, this is because sda5 & sda6 are logical partitions that can only exist inside the Extended partition container.

In Linux, logical partitions always start from 5, the numbers 1-4 are reserved for the 4 Primary partitions (including the 1 Extended).

This post has been edited by ongte: Jul 1 2009, 08:36 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
dRLurve
post Jul 2 2009, 12:58 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #10


Getting Started
**

Group: Junior Member
Posts: 194
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Oct 2008







QUOTE(ongte @ Jul 1 2009, 08:00 PM)
Basically you are in emergency mode where the filesystem is mounted read-only.
You can fix this easily with the command:
CODE
# mount -o remount /

This will remount the root '/' filesystem to read/write.

I'd also like to add that LVM does need to use a partition If you are using the entire disk as a PV, you can simple make the raw unpartitioned disk as PV, something like:
CODE
# pvcreate /dev/sdb /dev/sdc /dev/sdd


You only need to make LinuxLVM partitions if you are not using the whole disk for LVM. (such as on your /dev/sda)


Added on July 1, 2009, 8:36 pmI'd like to help clarify your initial question about partitions. Apologies upfront for the length.

When the msdos partition table was first invented, it only allowed the creation of 4 partitions.
These became known now as Primary partitions. (You can have only 4)

Later on, to overcome this limitation, a new type of partition called an Extended partition was invented. This was not an actual partition but is actually just a container designed to extend the limitation of the msdos partition table & allow for many more (logical) partitions.

You can have only 1 Extended partition & it must take the place of 1 of the Primary partitions.It should also take up all the free space on the disk. (This is because Logical partitions will be created inside the Extended partition container)

So a typical disk layout on Linux would look like this:
Total Cylinders on Disk = 4866
/dev/sda1 - Primary - Cylinder 1-398 - Linux Swap
/dev/sda2 - Primary - Cylinder 399-1021 - Mounted on /
/dev/sda3 - Primary - Cylinder 1022-2083 - Mounted on /home
/dev/sda4 - Extended - Cylinder 2084-4866 - Extended Container
/dev/sda5 - Logical - Cylinder 2084-3142 - Mounted on /usr
/dev/sda6 - Logical - Cylinder 3143-4866 - Mounted on /var

Notice that the Cylinder start for sda4 & sda5 is the same, this is because sda5 & sda6 are logical partitions that can only exist inside the Extended partition container.

In Linux, logical partitions always start from 5, the numbers 1-4 are reserved for the 4 Primary partitions (including the 1 Extended).
*




Bro, ur info help me alot!! Many thanks!!!!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
grub
post Jul 3 2009, 03:41 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #11


Newbie
*

Group: Junior Member
Posts: 8
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Feb 2009





QUOTE(dRLurve @ Jul 1 2009, 12:30 PM)
Thanks bro, i get u now.... simply say, by partitioning/format HDD using fdisk and LVM partition are two different thing?


Yup, you got the idea dude! rclxms.gif

QUOTE(dRLurve @ Jul 1 2009, 12:30 PM)
parted? can elaborate abit more? notworthy.gif
*



parted (under GNU license, i think) is another partition manager similar to fdisk. It's just a matter of preference though, but i find parted easier to use compared to fdisk.

For the problem you encountered after booting where you lose the LV, I believe you may have missed one or two final steps to write the changes to the disk when using fdisk.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Tachi
post Jul 3 2009, 06:26 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #12


Newbie
*

Group: Junior Member
Posts: 37
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jun 2009




I think he means gparted or qtparted. I think gparted is better. Its in the repo's.
BTW, extended partition can be anywhere, not the last one. Also swap need not be in primary, can be in one of logical in extended. Windows, at least XP needs to be 1st partition. FreeBSD, open BSD etc needs to be in primary, if installed to one of logical in extended, it will wipe out the other logical partitions.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Bump TopicReply to this topicTopic OptionsStart new topic
 



----debug section please ignore----
Lo-Fi Version Time is now: 23rd November 2009 - 07:17 AM
All Rights Reserved 2003-2009 Vijandren Ramadass (~living on a prayer~)