Solved

fdisk info help

Posted on 2006-06-12
12
671 Views
Last Modified: 2013-12-06
Hi
I am having trouble managing space on a disk with default install of Redhat (Red Hat Linux 3.2.3-47)
there is no room to add a partition but if I add up df output, I get about half of the disk capacity.


# fdisk /dev/sda

The number of cylinders for this disk is set to 19452.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 160.0 GB, 160000000000 bytes
255 heads, 63 sectors/track, 19452 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1           4       32098+  de  Dell Utility
/dev/sda2               5        3804    30523500   83  Linux
/dev/sda3   *        3805        3817      104422+  83  Linux
/dev/sda4            3818       19452   125588137+   5  Extended
/dev/sda5            3818       19452   125588106   8e  Linux LVM
____________________________________________________________
Command (m for help): n
No free sectors available
================================================
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup_ID_26484-LogVol2
                      1.8G  173M  1.6G  10% /
/dev/sda3              99M   15M   80M  16% /boot
none                  1.9G     0  1.9G   0% /dev/shm
/dev/mapper/VolGroup_ID_26484-LogVol3
                      496M   11M  460M   3% /tmp
/dev/mapper/VolGroup_ID_26484-LogVol6
                       51G   13G   36G  26% /usr
/dev/mapper/VolGroup_ID_26484-LogVol5
                      496M   92M  379M  20% /var
/dev/mapper/VolGroup_ID_26484-LogVolHome
                       29G  8.6G   19G  32% /home
0
Comment
Question by:mehranalmasi
  • 5
  • 3
  • 3
  • +1
12 Comments
 
LVL 20

Expert Comment

by:nedvis
Comment Utility
You should probably start by typing    
/sbin/lvm  lvdisplay  
       command in terminal window to get the list of logical volumes
and then ( once lvm prompt is opened )   pvscan to getinfo about available space of physycal volumes
and  lvs  to get the Size of volume groups.

Then you can proceed with  lvresize   or   pvresize  procedures to either resize logical volume(s) or phisical volumes .

here's the list of available lvm commands:
Available lvm commands:
  Use 'lvm help <command>' for more information

  dumpconfig      Dump active configuration
  formats         List available metadata formats
  help            Display help for commands
  lvchange        Change the attributes of logical volume(s)
  lvconvert       Change logical volume layout
  lvcreate        Create a logical volume
  lvdisplay       Display information about a logical volume
  lvextend        Add space to a logical volume
  lvmchange       With the device mapper, this is obsolete and does nothing.
  lvmdiskscan     List devices that may be used as physical volumes
  lvmsadc         Collect activity data
  lvmsar          Create activity report
  lvreduce        Reduce the size of a logical volume
  lvremove        Remove logical volume(s) from the system
  lvrename        Rename a logical volume
  lvresize        Resize a logical volume
  lvs             Display information about logical volumes
  lvscan          List all logical volumes in all volume groups
  pvchange        Change attributes of physical volume(s)
  pvresize        Resize physical volume(s)
  pvcreate        Initialize physical volume(s) for use by LVM
  pvdata          Display the on-disk metadata for physical volume(s)
  pvdisplay       Display various attributes of physical volume(s)
  pvmove          Move extents from one physical volume to another
  pvremove        Remove LVM label(s) from physical volume(s)
  pvresize        Resize a physical volume in use by a volume group
  pvs             Display information about physical volumes
  pvscan          List all physical volumes
  segtypes        List available segment types
  vgcfgbackup     Backup volume group configuration(s)
  vgcfgrestore    Restore volume group configuration
  vgchange        Change volume group attributes
  vgck            Check the consistency of volume group(s)
  vgconvert       Change volume group metadata format
  vgcreate        Create a volume group
  vgdisplay       Display volume group information
  vgexport        Unregister volume group(s) from the system
  vgextend        Add physical volumes to a volume group
  vgimport        Register exported volume group with system
  vgmerge         Merge volume groups
  vgmknodes       Create the special files for volume group devices in /dev
  vgreduce        Remove physical volume(s) from a volume group
  vgremove        Remove volume group(s)
  vgrename        Rename a volume group
  vgs             Display information about volume groups
  vgscan          Search for all volume groups
  vgsplit         Move physical volumes into a new volume group
  version         Display software and driver version information

------------------------------------
good luck
nedvis

 
0
 
LVL 1

Expert Comment

by:ico2
Comment Utility
cfdisk is a more friendly front-end for fdisk, also check out parted for resizing partitions and qtparted if you want a friendly front-end for that.
0
 
LVL 19

Expert Comment

by:jools
Comment Utility
`vgdisplay` will show the amount of free extents, it may show the free space in GB as well.

You can create a new logical volume easily enough using lvcreate, if you need to know more detail post back.
0
 

Author Comment

by:mehranalmasi
Comment Utility
Hi
I must be missing the point here. what happened to my other 80 GB of space? What are the exact steps to make it usable if I can do it with lvcreate

thanks,
Mehran
0
 
LVL 20

Expert Comment

by:nedvis
Comment Utility
There's nothing wrong with your free space .
fdisk gives you an information of the current partitoning status and you cannot add new partition without destroying current layout .
LVM is diferrent it gives you more informations and flexibility for managing existing partitions.
I think you should be able to run Logical Volume management GUI  if you have system-config-lvm 1.x.x installed on
your RedHat Enterprise 3 system
Just type in console  system-config-lvm to start the tool which will give you an overview of your partitions layout and
the way logical volems and groups are orginezed.
 This link also might be of help :
Chapter 7. Logical Volume Manager (LVM)
7.1. What is LVM?
LVM is a method of allocating hard drive space into logical volumes that can be easily resized instead of partitions.
http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/sysadmin-guide/ch-lvm-intro.html

nedvis
0
 

Author Comment

by:mehranalmasi
Comment Utility
Does this mean the default install rendered half of the disk unusable without doing more work?

from the fdisk results, what is the status of sda2? when I do mount -t ext3 /dev/sda2 /mountpoint I get

mount: wrong fs type, bad option, bad superblock on /dev/sda2,
       or too many mounted file systems

pvscan gives me:

pvscan
  /dev/cdrom: open failed: No medium found
  PV /dev/sda5   VG VolGroup_ID_26484   lvm2 [119.75 GB / 33.34 GB free]
  PV /dev/sda2   VG VolGroup_ID_26484   lvm2 [29.09 GB / 29.09 GB free]
  Total: 2 [148.84 GB] / in use: 2 [148.84 GB] / in no VG: 0 [0   ]

why sda3 is not included here?
I just cannot make sense out of numbers are given back. Can you tell how is the 160 MB devided between partitions?

thanks.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 20

Expert Comment

by:nedvis
Comment Utility
" Can you tell how is the 160 MB devided between partitions? "
Unfortunatelly no since I'm not sitting in front of your PC .
But you can run Logical Volumes Management from RedHat Administration group menu or by typing
 system-config-lvm
 
"Does this mean the default install rendered half of the disk unusable..."
No, but as I told you before LVM is pain in the a##%^$ to figure it out and configure
because it adds new layer of descriptions of partitions, volumes and volume groups.
The idea was to make disk/storage administration easier but as I can tell it didn't.
Even Experts-Exchange gurus like rindi ( http://www.experts-exchange.com/M_2312553.html )
admitted he's still not familiar with LVM features ( see the post :
http://www.experts-exchange.com/Operating_Systems/Linux/Q_21882610.html )

"why sda3 is not included here?"
It is included but it's trunkated with LVM volume LABELS !
/dev/sda3  is your /boot partition and by default it is not included in
LVM space transactions (space resizing, moving, allocating , free space redistribution etc.)

" when I do mount -t ext3 /dev/sda2 /mountpoint I get..."

You cannot mount partitioon or disk that are already mounted via RedHat Linux  /etc/fstab ( file system table)

nedvis
0
 

Author Comment

by:mehranalmasi
Comment Utility
Hi nedvis,
thanks for your info. I finally got to run system-config-lvm fron the console but as you say, I am not sure if I am doing any better. In the logical section I see only 2 MB space available. So I am still not sure how to make the rest of the disk availble. too bad I can't send you screen shots.

Mehran
0
 
LVL 19

Expert Comment

by:jools
Comment Utility
You could post a link to a site where the pictures can be downloaded to if that helps.

Your post above seems to indicate about 60GB available over the two PV's, can you post a `vgdisplay -v` back here so we can see a complete listing?

If the space free indicated is accurate, you should be able to create a new LV, using something like;
     # lvcreate -n work -L 58G VolGroup_ID_26484

If that works OK you will have to format it;
     # mkfs -t ext3 /dev/mapper/VolGroup_ID_26484-work

Then mount it;
     # mkdir /work
     # mount /dev/mapper/VolGroup_ID_26484-work /work
0
 

Author Comment

by:mehranalmasi
Comment Utility
# vgdisplay -v
    Finding all volume groups
    Finding volume group "VolGroup_ID_26484"
  --- Volume group ---
  VG Name               VolGroup_ID_26484
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  9
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                7
  Open LV               7
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               148.84 GB
  PE Size               32.00 MB
  Total PE              4763
  Alloc PE / Size       2765 / 86.41 GB
  Free  PE / Size       1998 / 62.44 GB
  VG UUID               va11Y2-c0TH-QwRU-8WD8-d6rJ-CNmJ-2xke1p

  --- Logical volume ---
  LV Name                /dev/VolGroup_ID_26484/LogVol2
  VG Name                VolGroup_ID_26484
  LV UUID                APzpMZ-ADN3-o75w-HsH2-DlCd-VKHD-KMZmFs
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.81 GB
  Current LE             58
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0

  --- Logical volume ---
  LV Name                /dev/VolGroup_ID_26484/LogVol3
  VG Name                VolGroup_ID_26484
  LV UUID                p118mw-3JnH-2KBk-4Eji-0MY6-Z6V0-aSY6EG
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                512.00 MB
  Current LE             16
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:1

  --- Logical volume ---
  LV Name                /dev/VolGroup_ID_26484/LogVol6
  VG Name                VolGroup_ID_26484
  LV UUID                Q5fbC2-Qru6-Ukp7-QaSp-LUdl-q6Qc-PKfWNF
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                51.00 GB
  Current LE             1632
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:2

  --- Logical volume ---
  LV Name                /dev/VolGroup_ID_26484/LogVol5
  VG Name                VolGroup_ID_26484
  LV UUID                7ZV3T4-VT0O-yo0V-soyl-pnec-TWHG-dpA6Fi
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                512.00 MB
  Current LE             16
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:3

  --- Logical volume ---
  LV Name                /dev/VolGroup_ID_26484/LogVol1
  VG Name                VolGroup_ID_26484
  LV UUID                BBu1hR-je0v-nra2-F3nv-7zJp-dWVp-2wwGSQ
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.97 GB
  Current LE             63
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:4

  --- Logical volume ---
  LV Name                /dev/VolGroup_ID_26484/LogVol0
  VG Name                VolGroup_ID_26484
  LV UUID                Hw5I06-xMRR-Fo7L-bH87-KJqF-urW8-ft5zXi
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                2.00 GB
  Current LE             64
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:5

  --- Logical volume ---
  LV Name                /dev/VolGroup_ID_26484/LogVolHome
  VG Name                VolGroup_ID_26484
  LV UUID                zHUWVc-Tb5l-L9UF-zCj0-Je5w-vvi9-j6bex3
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                28.62 GB
  Current LE             916
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:6

  --- Physical volumes ---
  PV Name               /dev/sda5
  PV UUID               ookVzV-ugQD-osaZ-K80o-7RT4-COCT-dmYtbZ
  PV Status             allocatable
  Total PE / Free PE    3832 / 1067

  PV Name               /dev/sda2
  PV UUID               vnEqyc-d13z-XcWb-m8FN-bnaB-Sn8B-A1WvbC
  PV Status             allocatable
  Total PE / Free PE    931 / 931
0
 
LVL 19

Accepted Solution

by:
jools earned 125 total points
Comment Utility
Ok, so you have the following lvols;

/                1.81GB        /dev/VolGroup_ID_26484/LogVol2
/tmp           512MB        /dev/VolGroup_ID_26484/LogVol3
/usr            51GB          /dev/VolGroup_ID_26484/LogVol6
/var            512MB        /dev/VolGroup_ID_26484/LogVol5
<swap?>    1.97GB       /dev/VolGroup_ID_26484/LogVol1
<swap?>    2GB           /dev/VolGroup_ID_26484/LogVol0
/home        28.62GB     /dev/VolGroup_ID_26484/LogVolHome

I've guessed that LogVol0 and 1 are swap as these are not listed in the top posting information, checking in /etc/fstab should verify this.

Your volume group is named as in the VG Name
>  VG Name               VolGroup_ID_26484

Your VG Size looks like the whole disk (excluding the boot partition and the Dell partition)
>  VG Size               148.84 GB

This information shows you the Physical Extent size and the number of allocated/free extents available in the VG, you'll notice that this currently shows 62.44GB which you have available to allocate to a logical volume (think here that this is free partition space), bear in mind that the actual value you can allocate will have to be divisible by your PE Size (32MB).

>  PE Size               32.00 MB
>  Total PE              4763
>  Alloc PE / Size       2765 / 86.41 GB
>  Free  PE / Size       1998 / 62.44 GB

The small confusing part of your setup is that your fdisk listing shows sda2 as a normal linux partition (type 83) where in actual fact it's actually part of the LVM setup and should be a Linux LVM type (8e), not that it matters but would help id the partition types on your disk.

You should be able to create a logical volume (partition) upto about 62GB, for instance, if you wanted to create a logical volume called "work" (it's good practice to give these logical names, LogVol00 would not mean that much to anyone after all!) you would use the lvcreate command (as root) and type the following;

     # lvcreate -n work -L 58G VolGroup_ID_26484

You would then need to format the logical volume

     # mkfs -t ext3 /dev/mapper/VolGroup_ID_26484-work

And then mount it, in the example below I just want it mounted under /work!

     # mkdir /work
     # mount /dev/mapper/VolGroup_ID_26484-work /work

And to have it mount automagically at reboot, add it to /etc/fstab, note here that there are links (at least on my setup) that point /dev/VolGroup<etc> to /dev/mapper/blah blah blah.

     /dev/VolGroup_ID_26484/work      /work            ext3    defaults        1 2

If you're not able to create a logical volume as shown above can you post back here with any errors you may be getting.

Cheers

J
0
 

Author Comment

by:mehranalmasi
Comment Utility
Cheers is it! it worked just as expected. thanks!
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now