Operating System - Linux
1751924 Members
4810 Online
108783 Solutions
New Discussion юеВ

Re: Creating a New File System

 
SOLVED
Go to solution
Michael Steele_2
Honored Contributor

Creating a New File System

vmlinuz-2.6.18-128.1.14.el5
Red Hat Enterprise Linux Client release 5.3 (Tikanga)

Hi

I'm prety much a Red Hat newbie and need some basic help about LVM and disk partitions. Here is some basic info. as well as an attached file.

# fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 2113 16771860 83 Linux
/dev/sda3 2114 2635 4192965 83 Linux
/dev/sda4 2636 9729 56982555 5 Extended
/dev/sda5 2636 2896 2096451 82 Linux swap / Solaris
/dev/sda6 2897 3157 2096451 83 Linux
/dev/sda7 3158 3418 2096451 83 Linux
###################################

# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 16246460 3127272 12280596 21% /
/dev/sda6 2030736 40552 1885364 3% /tmp
/dev/sda3 4061572 138748 3713176 4% /var
/dev/sda7 2030736 36072 1889844 2% /var/tmp
/dev/sda1 194442 16305 168098 9% /boot
tmpfs 451964 0 451964 0% /dev/shm

The attachement is 'system-config-lvm'. Note the 'initialize entry' button is not highlighted.

a) Could you explain to me what I am seeing?
b) Could you explain how to add in a vg, lvol, file system from here?

thanks!
Support Fatherhood - Stop Family Law
9 REPLIES 9
Steven E. Protter
Exalted Contributor

Re: Creating a New File System

Shalom Michael,

What you are seeing IMO is a system that does not use LVM.

None of the partitions are marked LVM and no volume groups have been created.

To add a volume group now would require allocation of a new disk partition, marking it as LVM with fdisk and running vgcreate to create a volume group.

If the system is not in production, I'd seriously consider doing the OS install again.


SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Michael Steele_2
Honored Contributor

Re: Creating a New File System

Hi SEP

Kinda thought that.

My goal is to add in another file system and take advantage of the current space provided.

Question: See previous attachement for "/dev/sda4 Extended" - How can I use this to make a new, what?, partition?, slice?, subdisk? and then mount a file system to it?

Question: See NEWLY attached. /dev/sda, unpartitioned space. 48 GB. Same question.
Support Fatherhood - Stop Family Law
Steven E. Protter
Exalted Contributor
Solution

Re: Creating a New File System

Shalom again Michael.

I saw the un-partitioned space while closing your openoffice doc. and felt pretty stupid about my original answer.

Lets say the device is /dev/sdg

fdisk to create a lvm (8e) partition
# May need to use partprobe or boot to force a kernel sync.

pvcreate /dev/sdg1
# Might if you try more than once to use -f or -ff


vgcreate test_vg /dev/sdg1

lvcreate -l 48G test_vg

mkfs.ext3 /dev/test_vg/lvol1

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Zinky
Honored Contributor

Re: Creating a New File System

Michael -- Long Time No Hear sir...!
On the UNIX-away path too? ;^))

From your fdisk, it appears your sda device (I trust this is a RAID disk?) - you have ~ 51.9gb remaining (6311 cyclinders). You can carve an sda8 "partition" by invoking fdisk and spec'ing the start and end cyl/block. Once done (you can do a partprobe to ensure the part table is reread).

Then you can either create a filesystem directly on sda8 (mkfs.ext3 /dev/sda8) OR make it into a PV and eventually a member of a VG (whose gyration is very much the same as HP-UX LVM -- but easier - as SEP outlined...)

Enjoy.
Hakuna Matata

Favourite Toy:
AMD Athlon II X6 1090T 6-core, 16GB RAM, 12TB ZFS RAIDZ-2 Storage. Linux Centos 5.6 running KVM Hypervisor. Virtual Machines: Ubuntu, Mint, Solaris 10, Windows 7 Professional, Windows XP Pro, Windows Server 2008R2, DOS 6.22, OpenFiler
Michael Steele_2
Honored Contributor

Re: Creating a New File System

K

I can see /dev/sda8. But I still don't know how to use the space in "/dev/sda4 Extended" 48 gb.

Why can't I make a file system out of this ?
Support Fatherhood - Stop Family Law
Zinky
Honored Contributor

Re: Creating a New File System

Michael.

sda4 is your "extended" partition from which sda5,sda6...sda8 is "allocated" from. DO NOT ever use your extended parition as you could corrupt the paritions contained within.

PC Styles disks are limited to 4 "Primary" paritions of which 1 needs to be extended parition IF you want to carve your disk beyond the 4 parition limit.

That is why LVM saves the day for us as it can slice and dice a whole disk or a parition of a whole disk far wider than native slicing plus other perks.
Hakuna Matata

Favourite Toy:
AMD Athlon II X6 1090T 6-core, 16GB RAM, 12TB ZFS RAIDZ-2 Storage. Linux Centos 5.6 running KVM Hypervisor. Virtual Machines: Ubuntu, Mint, Solaris 10, Windows 7 Professional, Windows XP Pro, Windows Server 2008R2, DOS 6.22, OpenFiler
Viktor Balogh
Honored Contributor

Re: Creating a New File System

Hi Michael,

If you are used to HP-UX LVM, in Linux a partition is the equivalent of the PV in HP-UX. A disk can have max. 4 primary partitions, or 3 primary and an extended partition, as Alzhy wrote.

I prefer utilizing the 'whole disk approach' also in Linux, so create a single partition to each disk you want to have in the LVM config. (fdisk/cfdisk) The rest is similar to the HP-UX method. Do a pvcreate for each partition, vgcreate/vgextend, etc...

If it is a testmachine with limited number of disks, you could create 4 primary partitions to each physical disk. That way you will have 4 times the PV than the physical disks, and have some room to experiment with the various allocation policies, etc...

In a production environment you must always create a single partition per disk, that way you can ensure that a disk won't be utilized for different LVs/FSs. The performance suffers if the disk head must be relocated back and forth.

It isn't necessary to create a partition anyway, the /dev/sd[a-z] devices can also be used with LVM, the existing partitions can be deleted. But this way there won't be any sign of the LVM usage on the disks - the LVM type can be set only to a partition.
****
Unix operates with beer.
Michael Steele_2
Honored Contributor

Re: Creating a New File System

Thaaaannnk Yooou All Folks

Note: After performing NOTE: that pvcreate failed due to a linux bug in /etc/lvm/lvm.conf. I am documenting it here.

pvcreate /dev/sda8
ERROR: 'disk doesn't exist, or is being filtered'

vi /etc/lvm/lvm.conf
devices ()

# filter = [ "r|^/dev/mapper/.*-lv.*|", "a|^/dev/mapper/.*|", "r/.*/" ]

filter = [ "r|^/dev/mapper/.*-lv.*|", "a|^/dev/mapper/.*|"]

Note: The last arguement is removed or errors on pvcreate.
Support Fatherhood - Stop Family Law
Michael Steele_2
Honored Contributor

Re: Creating a New File System

,
Support Fatherhood - Stop Family Law