Showing results for 
Search instead for 
Did you mean: 

linux file system layout

Super Advisor

linux file system layout

hi , i am new in linux,


in hp-unix we create the lv in below steps

1.create pv

2.create vg

3.create lv


but in linux i am confused with partions /dev/sda ,please explain what is partions and volume group and lv

Honored Contributor

Re: linux file system layout

Consider the /dev/sda devices as equivalent to the /dev/dsk/c?t?d? devices in HP-UX.  You use the /dev/sd? devices exactly the same. 


You run pvcreate against the /dev/sd? device, then you create the volume group and logical volume.



Super Advisor

Re: linux file system layout

thanks for your reply. could you please share the procedure to create the PV,VG,LV in linux

Honored Contributor

Re: linux file system layout

For application/data disks, the procedure can be exactly the same as in HP-UX. For example, if your disk is /dev/sdx and you want to create a 10 GB LV on it:


pvcreate /dev/sdx

vgcreate vgNAME /dev/sdx

lvcreate -L 10G vgNAME


(If you don't specify a LV name with the -n option of the lvcreate command, a default name of the form "lvolN" will be created. Unlike HP-UX, the first default LV name is lvol0, not lvol1.)


In Linux, there are no restrictions for VG or LV naming: you can name them as you wish, but I think it is a good idea to keep common prefixes for all VG and all LV names, to minimize confusion.


There are also two ways to specify a full LV pathname: you can use HP-UX style /dev/vgNAME/lvol0, or Linux native style /dev/mapper/vgNAME-lvol0. For most purposes, the two names are equal; but if you use LVM on your system disk, it may be necessary to use a particular naming style to identify your root filesystem, as stripped-down versions of the LVM utilities may be used at the early phases of the system start-up.


For a system disk, it's a bit more complex, just like on Itanium HP-UX systems.

In order to allow a BIOS-based bootloader like GRUB to work, the disk must have a traditional PC partition table, and all the things that the bootloader needs must be in a traditional partition, not in a LVM volume. Normally the /boot directory contains everything the bootloader needs, and so /boot can be easily be made into a separate filesystem.


So if you want to use LVM on a system disk /dev/sdy,  you first use the fdisk command (or cfdisk, or sfdisk, or parted...) to create at least two partitions:

/dev/sdy1 = about 100 - 500 MB filesystem for /boot (partition type "Linux")

/dev/sdy2 = the rest of disk space, to be used as a LVM PV (partition type "Linux LVM")


Usually you don't need to do this manually, as the Linux OS installer will do it for you. But seeing the steps may help you understand... so, if we choose the name "vgsys" for our new system VG, and "lvroot", "lvswap", "lvhome", "lvtmp" and "lvvar" for the LVs: (you don't have to create all these partitions, but in a production server, having /var and /tmp as separate partitions will minimize the problems caused if /tmp or /var/spool becomes 100% full, for example.)


pvcreate /dev/sdy2

vgcreate vgsys /dev/sdy2

lvcreate -L 4G -n lvroot vgsys

lvcreate -L 8G -n lvswap vgsys

lvcreate -L 1G -n lvtmp vgsys

lvcreate -L 6G -n lvvar vgsys

lvcreate -L 1G -n lvhome vgsys # to be expanded later if necessary


Now, you'll have a set of devices ready for mkfs. Here are the partition/LV names in Linux native style:

/dev/sdy1 for /boot

/dev/mapper/vgsys-lvroot for /

/dev/mapper/vgsys-lvtmp for /tmp

/dev/mapper/vgsys-lvvar for /var

/dev/mapper/vgsys-lvhome for /home


and /dev/mapper/vgsys-lvswap is ready for mkswap.


The last step is installing the bootloader. On Linux servers, it is usually installed to the Master Boot Record, which is not part of any partition, so you'll do something like "grub-install /dev/sdy".


This is actually rather similar to a HP-UX Itanium system disk layout, except that /boot is actually mountable as a regular partition: in HP-UX, you need special commands like efi_ls and efi_cp to access it.


Note that the newest x86_64 PC servers are starting to have an UEFI firmware instead of a regular BIOS. With these systems, the system disk layout can be even more similar to HP-UX Itanium layout. The EFI system partition will often be mounted to /boot/efi, but the exact details will depend on the Linux distribution you choose.


However, my opinion is that most of the first-generation UEFI firmware implementations I've seen are rather sucky, so for the moment, it may be a better idea to rely on the BIOS compatibility layer that is built into x86_64 UEFI firmwares. With it, you can use a UEFI-based PC system just like a regular BIOS-based PC system.


But when system disks of 2 TB or larger size will become the norm, you won't be able to use a traditional PC-style bootloaders any more, and must migrate to UEFI. So we all should prepare to learn some new UEFI things in the next 3-5 years or so. If you are already familiar with EFI on Itanium HP-UX, it will be easy for you!

Super Advisor

Re: linux file system layout



every system we find below file system, please explain usage for below file system.


tmpfs                 16408828         0  16408828   0% /dev/shm



Honored Contributor

Re: linux file system layout