LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 05-31-2010, 02:34 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 36
How to increase hard disk in linux


Hi guys i have created a linux machine in virtual box now i want to add some hard disk space into it.
How would i do this.

Please help.

Machine details are as below


Code:
# lsb_release -a
LSB Version:    :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: EnterpriseEnterpriseServer
Description:    Enterprise Linux Enterprise Linux Server release 5.2 (Carthage)
Release:        5.2
Codename:       Carthage
Code:
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      6.7G  4.3G  2.2G  67% /
/dev/hda1              99M   12M   83M  13% /boot
tmpfs                 252M     0  252M   0% /dev/shm

Code:
# cat /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0

Last edited by pinga123; 05-31-2010 at 02:36 AM.
 
Old 05-31-2010, 03:04 AM   #2
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 36
I m posting the output after adding 100 mb disk.
(From output of below command i came to conclusion thatNothing has changed to output of these commands. Where would i find the additional 100 mb .To be honest i have never mounted or added new harddisk even on physical machine. Please guide)

Code:
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      6.7G  4.3G  2.2G  67% /
/dev/hda1              99M   12M   83M  13% /boot
tmpfs                 252M     0  252M   0% /dev/shm

Code:
# cat /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
 
Old 05-31-2010, 03:36 AM   #3
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
Hi pinga123,

In order for me to help you can you please answer the following questions and post output where necessary:

1. What distro/version are you using? (I suspect RHEL/CentOS 5?)

2. What hypervisor are you using for virtualization (Xen/KVM/VMware/VBox)

3. How many physical hard drives does your machine have?

4. Please post the output of the following commands:

Code:
# fdisk -l

# pvdisplay

# vgdisplay

# lvdisplay 

# mount
 
Old 05-31-2010, 04:37 AM   #4
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by alli_yas View Post
Hi pinga123,

In order for me to help you can you please answer the following questions and post output where necessary:

1. What distro/version are you using? (I suspect RHEL/CentOS 5?)
I m using oracle enterprise linux which is redhat modified version.


Quote:
2. What hypervisor are you using for virtualization (Xen/KVM/VMware/VBox)
I m using Virtual Box.

Quote:
3. How many physical hard drives does your machine have?
Physical or virtual ?

I have created a hard disk of 8 gb to my virtual machine and installed it.
later i have created a hard disk of 100 mb . Now i want to add this to existing machine.


Quote:
4. Please post the output of the following commands:
Quote:
Before adding the hard disk of 100 mb size.
Code:
# fdisk -l

Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        1044     8281507+  8e  Linux LVM

# pvdisplay

--- Physical volume ---
  PV Name               /dev/hda2
  VG Name               VolGroup00
  PV Size               7.90 GB / not usable 23.41 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              252
  Free PE               0
  Allocated PE          252
  PV UUID               5US9WF-sSdE-fMvK-kOfB-Jwo4-qfCm-dmBuFk

# vgdisplay

--- 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.88 GB
  PE Size               32.00 MB
  Total PE              252
  Alloc PE / Size       252 / 7.88 GB
  Free  PE / Size       0 / 0
  VG UUID               XAyofI-B3e9-iaoz-LuLo-nA8z-UXhJ-4MoN0Q

# lvdisplay 
 --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV UUID                lN29H1-VPkm-c1xj-jrqE-JwFw-X3bV-qSZgoM
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                6.88 GB
  Current LE             220
  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                FvOO69-1GXL-XwGm-nHZj-3vft-zMsg-6IINcw
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.00 GB
  Current LE             32
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)


After adding 100 mb space .
# fdisk -l
Code:
Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        1044     8281507+  8e  Linux LVM
# pvdisplay
Code:
--- Physical volume ---
  PV Name               /dev/hda2
  VG Name               VolGroup00
  PV Size               7.90 GB / not usable 23.41 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              252
  Free PE               0
  Allocated PE          252
  PV UUID               5US9WF-sSdE-fMvK-kOfB-Jwo4-qfCm-dmBuFk
#vgdisplay
Code:
--- 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.88 GB
  PE Size               32.00 MB
  Total PE              252
  Alloc PE / Size       252 / 7.88 GB
  Free  PE / Size       0 / 0
  VG UUID               XAyofI-B3e9-iaoz-LuLo-nA8z-UXhJ-4MoN0Q

# lvdisplay
Code:
 --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV UUID                lN29H1-VPkm-c1xj-jrqE-JwFw-X3bV-qSZgoM
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                6.88 GB
  Current LE             220
  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                FvOO69-1GXL-XwGm-nHZj-3vft-zMsg-6IINcw
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.00 GB
  Current LE             32
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
#mount
Code:
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

Last edited by pinga123; 05-31-2010 at 04:51 AM.
 
Old 05-31-2010, 04:56 AM   #5
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
Hi pinga123,

Apologies I may have been unclear in my questions.

On your HOST system (that is not the VM), how many physical disks (and what size) do you have?

If you have created a 100MB logical volume on the host side and allocated to your Virtual Machine, what you can do is on the host side extend this logical volume to your desired size. This can be achieve using the lvextend command (make sure that your VM is powered off when you're doing this).

Once you've extended the LV, powering on your VM should result in the VM seeing the larger "hard drive".
 
Old 05-31-2010, 05:02 AM   #6
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by alli_yas View Post
Hi pinga123,

Apologies I may have been unclear in my questions.

On your HOST system (that is not the VM), how many physical disks (and what size) do you have?

If you have created a 100MB logical volume on the host side and allocated to your Virtual Machine, what you can do is on the host side extend this logical volume to your desired size. This can be achieve using the lvextend command (make sure that your VM is powered off when you're doing this).

Once you've extended the LV, powering on your VM should result in the VM seeing the larger "hard drive".
Thanks for your reply but that is not what i want to achieve.

I m new to linux and i m using vm to do some experiment on linux and learn new things.
I want to learn steps required to add a new hard disk to existing linux.
SO i have created new hard disk of size 100 mb and trying to add it to existing linux which is using 8 gb hard disk.

Can u please tell me which command should i use.

I dont want to use lvm . just normal adding of new hardisk will do.

Later on some other day i will try LVM concept
 
Old 05-31-2010, 05:20 AM   #7
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
Oh OK I see what you're trying to achieve.

The fact that you're using a VM to try to do this will complicate matters.

I'm not very familiar with Virtual Box, but you would need to modify your virtual machine's configuration to be able to assign this additional 100MB to your VM.

Following this, a reboot of your VM should result in the OS detecting the additional device (the 100MB).

Thereafter doing fdisk -l; should show this device (/dev/hdX or /dev/sdX) - and there you go.

Following that you can partition this new device (fdisk /dev/hdX or fdisk /dev/sdX); and thereafter create a filesystem and mount this wherever you wish.
 
Old 05-31-2010, 06:05 AM   #8
sohail0399
Member
 
Registered: Oct 2008
Location: Pakistan, Islamabad
Distribution: CentOS, Fedora, Solaris
Posts: 154

Rep: Reputation: 23
You have to create a new disk through Virtual boX
and add this disk on the machine you want, through VBox tool.
then in your machine you have to add disk through fdisk utility.
and then mount it.
and save the information in /etc/fstab
 
Old 05-31-2010, 06:17 AM   #9
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
# fdisk /dev/hdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help):
What command should i fire?
 
Old 05-31-2010, 06:24 AM   #10
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
Quote:
# fdisk /dev/hdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help):
If you hit p this should print the partition table for the disk.

Then you can hit n and you should get something like:

Quote:
Command (m for help): n

Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 4
First cylinder (1-3965, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-3965, default 3965):
Using default value 3965
Thereafter you hit w which will write the partition table changes; and you either reboot or partprobe in order for the OS to detect your new partition.

Following this you can use mke2fs to create a filesystem on this partition and the mount command to mount the filesystem.

Please do some research on partitioning to gain a better understanding.
 
Old 05-31-2010, 07:13 AM   #11
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by alli_yas View Post
If you hit p this should print the partition table for the disk.

Then you can hit n and you should get something like:



Thereafter you hit w which will write the partition table changes; and you either reboot or partprobe in order for the OS to detect your new partition.

Following this you can use mke2fs to create a filesystem on this partition and the mount command to mount the filesystem.

Please do some research on partitioning to gain a better understanding.
Y did you select primary partition and partition number 4?

Please explain.
 
Old 05-31-2010, 07:41 AM   #12
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
Hi

I chose 4 randomnly to demonstrate to you on one of my desktops.

You're allowed up to four "primary" partitions which consist of only a single filesystem.

You're allowed one "extended" partition which can contain multiple sub-partitions (such as logical volumes) and filesystems.

I really suggest you read up on partitioning - some links suggested below:

http://en.wikipedia.org/wiki/Disk_partitioning

http://tldp.org/HOWTO/Partition/fdisk_partitioning.html

http://www.slackbook.org/html/instal...titioning.html

Unfortunately I won't be able to answer all the questions you have on partitioning in this one thread or it won't end
 
  


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
How can i increase hard disk space cyrilbritto Linux - Hardware 5 08-26-2011 08:15 AM
hard disk partitioning/I am out of space /how to increase linux space? RMLinux Red Hat 8 09-05-2008 01:33 PM
how to increase the hard disk space of linux? hari78 Linux - Newbie 5 03-01-2005 06:09 AM
Increase hard-disk / space in FreeB noir911 *BSD 0 05-01-2004 10:57 PM
How do I increase my Raid Hard Disk gibs Red Hat 0 09-16-2003 07:15 PM


All times are GMT -5. The time now is 12:51 AM.

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