LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-12-2009, 10:38 PM   #1
ilovelinux9999
LQ Newbie
 
Registered: Jan 2009
Posts: 4

Rep: Reputation: 1
repartinoing disk space


Hi all,
I have a fedora installation on VM.
Here is my file system :

Code:
[hh@rh4 ~]$ df -h 
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      3.9G  3.8G   47M  99% /
/dev/sda1             190M   14M  167M   8% /boot
tmpfs                 1.2G   88K  1.2G   1% /dev/shm


How can I repartion this , so that more disk space is allocated to VolGroup00-LogVol00 instead of tmpfs?

many thanks,
HH
 
Old 01-12-2009, 11:57 PM   #2
uks
Member
 
Registered: Jul 2007
Posts: 72

Rep: Reputation: 16
I am sure your hard drive has more space looking at the partition list.
You can create more logiical volumes using lvcreate or increase the existing logical volume using lvextend like this for instance to extend it by another 7 Gig:

lvextend -L +7G /dev/VolGroup00/LogVol00
resize2fs /dev/Volumo00/LogVol00

Make sure you have a backup. The above is just an example.
Try it before using it on production.

tempfs uses virtual memory and has temporary data.

Last edited by uks; 01-12-2009 at 11:59 PM.
 
Old 01-13-2009, 01:59 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
As uks pointed out, tempfs is in memory so is not disk space available for you to grow VolGroup00 into.

Your question cannot be answered without some more information about the disk(s) on your system and VolGroup00.

Tell us about your disk(s) by posting the output, for each HDD (hard disk drive), from the following 3 commands, changing <HDD device name> to the name for the HDD device files on your system. It would be /dev/sda for the only HDD that we know about from your post.

parted <HDD device name> print
cfdisk -Ps <HDD device name>
fdisk -l <HDD device name>

Don't worry if you do not have all 3 commands -- just give us what you can.

Tell us about VolGroup00 by posting the output from
vgdisplay -v
 
Old 01-13-2009, 06:26 PM   #4
ilovelinux9999
LQ Newbie
 
Registered: Jan 2009
Posts: 4

Original Poster
Rep: Reputation: 1
hi all, thank you so much for your help.

catkin,
here are the results of executing the commands.

Code:
                               
[root@rh4 hh]# parted /dev/mapper/VolGroup00-LogVol00 print
Model: Linux device-mapper (dm)
Disk /dev/mapper/VolGroup00-LogVol00: 4194MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  4194MB  4194MB  ext3              

[root@rh4 hh]# parted /dev/sda print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      32.3kB  206MB   206MB   primary  ext3         boot 
 2      206MB   8587MB  8382MB  primary               lvm  

[root@rh4 hh]# parted /dev/sda1 print
Model: Unknown (unknown)
Disk /dev/sda1: 206MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0.00B  206MB  206MB  ext3              

[root@rh4 hh]# parted /dev/sda2 print
Error: /dev/sda2: unrecognised disk label                                 
[root@rh4 hh]# parted /dev/mapper/VolGroup00-LogVol01 print
Model: Linux device-mapper (dm)
Disk /dev/mapper/VolGroup00-LogVol01: 4127MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  4127MB  4127MB  linux-swap        

[root@rh4 hh]# cfdisk -Ps /dev/sda 
Partition Table for /dev/sda

               First       Last
 # Type       Sector      Sector   Offset    Length   Filesystem Type (ID) Flag
-- ------- ----------- ----------- ------ ----------- -------------------- ----
 1 Primary           0      401624     63      401625 Linux (83)           Boot
 2 Primary      401625    16771859      0    16370235 Linux LVM (8E)       None
[root@rh4 hh]# cfdisk -Ps /dev/sda1 
FATAL ERROR: No partition table.

[root@rh4 hh]# cfdisk -Ps /dev/sda2 
FATAL ERROR: No partition table.

[root@rh4 hh]# cfdisk -Ps /dev/mapper/VolGroup00-LogVol00
FATAL ERROR: No partition table.

[root@rh4 hh]# cfdisk -Ps /dev/mapper/VolGroup00-LogVol01
FATAL ERROR: Bad signature on partition table


[root@rh4 hh]# fdisk -l /dev/sda1

Disk /dev/sda1: 205 MB, 205599744 bytes
255 heads, 63 sectors/track, 24 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/sda1 doesn't contain a valid partition table
[root@rh4 hh]# fdisk -l /dev/sda2

Disk /dev/sda2: 8381 MB, 8381560320 bytes
255 heads, 63 sectors/track, 1019 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/sda2 doesn't contain a valid partition table
[root@rh4 hh]# fdisk -l /dev/mapper/VolGroup00-LogVol00

Disk /dev/mapper/VolGroup00-LogVol00: 4194 MB, 4194304000 bytes
255 heads, 63 sectors/track, 509 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/VolGroup00-LogVol00 doesn't contain a valid partition table
[root@rh4 hh]# fdisk -l /dev/mapper/VolGroup00-LogVol01

Disk /dev/mapper/VolGroup00-LogVol01: 4127 MB, 4127195136 bytes
255 heads, 63 sectors/track, 501 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x30307800

Disk /dev/mapper/VolGroup00-LogVol01 doesn't contain a valid partition table
[root@rh4 hh]# vgdisplay -v
    Finding all volume groups
    Finding volume group "VolGroup00"
  --- Volume group ---
  VG Name               VolGroup00
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               7.78 GB
  PE Size               32.00 MB
  Total PE              249
  Alloc PE / Size       248 / 7.75 GB
  Free  PE / Size       1 / 32.00 MB
  VG UUID               SUxqXy-Fqqq-tMmD-UNbi-uwDR-dcTa-StZNRJ
   
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV UUID                JQJQB2-zFwU-o53A-4AX0-duhf-nxDm-HbtHRF
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                3.91 GB
  Current LE             125
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol01
  VG Name                VolGroup00
  LV UUID                0q7Kps-rTFh-mxeS-Bn9I-X6kM-8GSh-KwubNL
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                3.84 GB
  Current LE             123
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
   
  --- Physical volumes ---
  PV Name               /dev/sda2     
  PV UUID               rJBVDS-aXuY-0yrH-WCYV-BIut-PuKg-WPVFlz
  PV Status             allocatable
  Total PE / Free PE    249 / 1
 
Old 01-14-2009, 01:06 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Hello ilovelinux9999

The error messages you got are because you ran the requested commands on partitions and volumes as well as disks. No problem. A disk is a physical thing; Linux calls them /dev/hda, /dev/hdb etc or /dev/sda, sdb etc. For convenience, disks can be divided into partitions, see http://en.wikipedia.org/wiki/Disk_partitioning for more information. Linux calls the partitions on /dev/sda: /dev/sda1, /dev/sda2, etc.

A volume is what you create a file system in. The most simple volume is a partition; this is what you have in /dev/sda1 with your /boot file system.

More complexly, you can create a volume by configuring space from a pool of disk space taken from several partitions. This is what LVM does -- it creates logical volumes (LVs) from a pool of partitions assigned to it. In your case you have only one partition assigned to LVM.

The output from "parted /dev/sda print" shows that the /dev/sda disk is 8590MB and that it is all used, split into two partitions: /dev/sda1 and /dev/sda2. /dev/sda1 is your /boot file system (shown by your first post). /dev/sda2 is assigned to LVM.

LVM has been configured to create two volumes from the space assigned to it: LogVol00 and LogVol01. All the available space is assigned to these volumes; there is no spare.

Your first post shows LogVol00 is used for your / file system; it is gruesomely full at 99% (better to stay below 75% to avoid fragmentation and hence slow performance).

LogVol01 is used for swap; when your computer does not have enough memory to do its work, it temporarily frees some up by swapping the contents of memory out into the swap space on disk.

The only place you have to get space to give to your / file system without buying another hard disk is to take it from your swap space. You have 3.8 GB of swap space, probably way more than you need. Any idea why it is so big? There is no "right" amount of swap space; the "sweet" choice depends on many factors, including being desperately short of disk space!

Can you check how much swap space you actually use? Once you have decided how much swap space you need you could reduce LogVol01 and extend LogVol00 then resize the / file system.

None of that is going to be easy. Is LVM the right choice for you? It is powerful, flexible and permits snapshots which are great for backups but those benefits come at the cost of complexity, especially when trying to resize the / file system. You may be better off reinstalling without LVM.

Best

Charles
 
Old 01-14-2009, 08:19 PM   #6
ilovelinux9999
LQ Newbie
 
Registered: Jan 2009
Posts: 4

Original Poster
Rep: Reputation: 1
ok so I did the following :

1)
Code:
[root@rh4 hh]# lvreduce -L 2G /dev/mapper/VolGroup00-LogVol01 
  WARNING: Reducing active and open logical volume to 2.00 GB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol01? [y/n]: y
  Reducing logical volume LogVol01 to 2.00 GB
  Logical volume LogVol01 successfully resized

2)

Code:
lvextend -L 2G /dev/mapper/VolGroup00-LogVol00 
  New size given (64 extents) not larger than existing size (125 extents)
  Run `lvextend --help' for more information.

3)

Code:
[root@rh4 hh]# resize2fs /dev/mapper/VolGroup00-LogVol00
resize2fs 1.41.3 (12-Oct-2008)
The filesystem is already 1024000 blocks long.  Nothing to do!

[root@rh4 hh]# resize2fs /dev/mapper/VolGroup00-LogVol01
resize2fs 1.41.3 (12-Oct-2008)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/VolGroup00-LogVol01
Couldn't find valid filesystem superblock.
4)

Code:
[root@rh4 hh]# df -h 
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      3.9G  3.9G     0 100% /
/dev/sda1             190M   14M  167M   8% /boot
tmpfs                 1.2G   88K  1.2G   1% /dev/shm
[root@rh4 hh]#

I think I am missing something, right ?
 
Old 01-14-2009, 10:50 PM   #7
yzhong
Member
 
Registered: Jun 2007
Location: sydney
Distribution: redhat , ubuntu, centos
Posts: 56

Rep: Reputation: 16
You can run vgdisplay to see if the 2G you reduced from swap is available to use.
 
Old 01-15-2009, 12:24 PM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by ilovelinux9999 View Post
[snip]
2)

Code:
lvextend -L 2G /dev/mapper/VolGroup00-LogVol00 
  New size given (64 extents) not larger than existing size (125 extents)
  Run `lvextend --help' for more information.
I think I am missing something, right ?
Right! The clue is in New size given (64 extents) not larger than existing size (125 extents) but it's good it didn't work because you would have trashed your / file system if it had. You were reducing the wrong logical volume!

If there is any data on this system you care about then a tested backup would be a smart move.

It would also be a smart move to free some space on /. Sytems behave unpredictably when / is full and that is exactly what you don't want when doing delicate changes like this.

For general information about LVM (a good understanding can be very useful!) see http://elibrary.fultus.com/technical...lvm-intro.html and http://www.tldp.org/HOWTO/LVM-HOWTO/. For single user, single HDD systems the most beneficial LVM design is to have / in a partition and /home, /opt, /usr, /var in logical volumes. If swap size can be confidently determined then it, too, is better in a partition than in a logical volume.

For a procedure to reduce a LV used for swap, see http://elibrary.fultus.com/technical...-removing.html.

After reducing the swap logical volume (dev/mapper/VolGroup00-LogVol01) you can extend the / logical volume (dev/mapper/VolGroup00-LogVol00); you are then faced with the problem of resizing the file system to fill it. Your / file system is ext3 and, best I know, that cannot be reliably resized while it is mounted but it must be mounted for the system to run. Catch 22!

What to do? You could try resizing / on the running system if you are OK with the risk of it trashing your system. Otherwise you need to boot from a Linux CD/DVD which includes device-mapper in the kernel and LVM2 executables in the file system and make the change then. This is difficult to plan and a time when a good understanding of LVM is useful for coping with the unexpected. Still worth planning, though! I couldn't find any pages on the 'net with a good procedure. It will probably require these commands after booting from CD/DVD:
# pvscan
# vgscan --mknodes
# vgchange -a y

Best

Charles
 
Old 01-15-2009, 12:33 PM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Sorry -- I was a bit hasty reading your last post and did not fully understand it. You have already reduced the swap volume, LogVol01, but done so while it is in use for swap. That's dangerous but you may get away with it if swap is not actually being used. I do not know enough about the internal workings of kernel and LVM to advise. A reboot may be the safest/only way to get out of the situation.

When you entered the command "lvextend -L 2G /dev/mapper/VolGroup00-LogVol00" I think you missed off a +, that is you meant to enter "lvextend -L +2G /dev/mapper/VolGroup00-LogVol00".
 
Old 01-15-2009, 05:22 PM   #10
ilovelinux9999
LQ Newbie
 
Registered: Jan 2009
Posts: 4

Original Poster
Rep: Reputation: 1
Hi Catkin,
sorry for not posting the replay clearly . but you are correct once I rebooted and then used the proper command (lvextend -L +2G /dev/mapper/VolGroup00-LogVol00) I got some additional disk space that I wanted .

Everyone,
I really need to start looking on the resource for disk partitioning before I ask more questions. Finally, I am really grateful for everyone kind response.

thanks again,
HH
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
partition space and disk space usage and free don't match nsic Linux - Newbie 3 02-22-2013 01:57 PM
hard disk partitioning/I am out of space /how to increase linux space? RMLinux Red Hat 8 09-05-2008 01:33 PM
add space to / when from spare space on disk ctsiow Linux - General 4 11-07-2007 08:55 AM
Cedega "Disk space required for the installation exceeds available disk space" Solved Spewdemon LinuxQuestions.org Member Success Stories 1 10-18-2007 07:19 PM
3Gb of disk space lost! Disk space problem or mother board conflicts with HDD Mistreated Linux - Hardware 4 12-06-2004 04:58 PM


All times are GMT -5. The time now is 04:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration