How to increase hard disk in linux


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to increase hard disk in linux
# 1  
Old 05-31-2010
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

# 2  
Old 05-31-2010
add a new virtual disk to the virtual machine and mount it where you need it.
# 3  
Old 05-31-2010
Quote:
Originally Posted by DukeNuke2
add a new virtual disk to the virtual machine and mount it where you need it.
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:
#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

Disk /dev/hdb: 104 MB, 104857600 bytes
16 heads, 63 sectors/track, 203 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Disk /dev/hdb doesn't contain a valid partition table


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 06:06 AM..
# 4  
Old 05-31-2010
The disk is (probably) attached as /dev/hdb. Check the output of dmesg to be sure. Now, create a new partition on the disk by running fdisk. I'd suggest creating an explicit LVM partition to add it to the existing VG.

Then, initialize the new partition for use with LVM, add it to the existing VG, and either create a new LV, or extend the existing:
Code:
pvcreate /dev/hdb1 #Initialize
vgextend VolGroup00 /dev/hdb1 #Extend VG
lvextend +L100M VolGroup00/LogVol00 # Extend LV
lvcreate -n LogVol02 -L100M VolGroup00 # Create new LV

Use the LVs as you would any other partition.

For more details on LVM, see the RHEL 5 LVM Guide
This User Gave Thanks to pludi For This Post:
# 5  
Old 05-31-2010
Quote:
Originally Posted by pludi
The disk is (probably) attached as /dev/hdb. Check the output of dmesg to be sure. Now, create a new partition on the disk by running fdisk. I'd suggest creating an explicit LVM partition to add it to the existing VG.

Then, initialize the new partition for use with LVM, add it to the existing VG, and either create a new LV, or extend the existing:
Code:
pvcreate /dev/hdb1 #Initialize
vgextend VolGroup00 /dev/hdb1 #Extend VG
lvextend +L100M VolGroup00/LogVol00 # Extend LV
lvcreate -n LogVol02 -L100M VolGroup00 # Create new LV

Use the LVs as you would any other partition.

For more details on LVM, see the RHEL 5 LVM Guide
Thanks for the reply .

Output of dmesg is too long what shall i search in that?
# 6  
Old 05-31-2010
If the output of dmesg goes by too fast, pipe it into less:
Code:
dmesg | less

You could grep for the term 'hardware sectors', but I can't guarantee that this will work. However most current Linux distributions use udev (or similar) to manage the /dev mount, so you won't see any devices there aren't connected somehow. So if there's a /dev/hdb, that's your best candidate.
This User Gave Thanks to pludi For This Post:
# 7  
Old 05-31-2010
Quote:
Originally Posted by pludi
If the output of dmesg goes by too fast, pipe it into less:
Code:
dmesg | less

You could grep for the term 'hardware sectors', but I can't guarantee that this will work. However most current Linux distributions use udev (or similar) to manage the /dev mount, so you won't see any devices there aren't connected somehow. So if there's a /dev/hdb, that's your best candidate.
#cd /dev/hd
hda hda1 hda2 hdb hdc

Its showing now as hdb . I forgot to add new harddisk to existing VM box.

---------- Post updated at 05:17 AM ---------- Previous update was at 03:54 AM ----------

Code:
# 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):

Which command should i fire?

Last edited by pinga123; 05-31-2010 at 06:04 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Increase disk size of guest domain

Host System: SPARC S7-2 Server; 2x8-core CPUs; 128Gb RAM; 2x600Gb HDD. running Solaris 11.3. Last login: Tue Sep 19 14:42:42 2017 from xxx.xxx.xxx Oracle Corporation SunOS 5.11 11.3 June 2017 $ uname -a SunOS sog01 5.11 11.3 sun4v sparc sun4v $ Original physical systems: Sun... (0 Replies)
Discussion started by: apmcd47
0 Replies

2. SCO

Increase disk size on OS side on the fly

Hi, I'm Linux administrator who happens to 'administer' SCO Unix 5.0.7, which is virtual server on VMware - deployed from official ovf image. My problem is that root filesystem is almost out of disk space, and we've decided to do it as we do on every other virtual servers and extend disk on... (13 Replies)
Discussion started by: goldenboy
13 Replies

3. Solaris

Delete syslog but size disk can't increase

Hi Experts, I have a problem wih /var. Disk /var is full. After i investigate, i found file /var/log/syslog.0 is growing rapidly. The size is 4.3G. I tried to move syslog.0 to another disk and file was moved successfully. My question is why size /var can't increase? used space still 100%. ... (7 Replies)
Discussion started by: edydsuranta
7 Replies

4. Linux

C++ Code to Access Linux Hard Disk Sectors (with a LoopBack Virtual Hard Disk)

Hi all, I'm kind of new to programming in Linux & c/c++. I'm currently writing a FileManager using Ubuntu Linux(10.10) for Learning Purposes. I've got started on this project by creating a loopback device to be used as my virtual hard disk. After creating the loop back hard disk and mounting it... (23 Replies)
Discussion started by: shen747
23 Replies

5. SCO

declare disk driver for IDE hard disk

hi I've a fresh installation of SCO 5.0.7 on the IDE hard disk. For SCSI hard disk I can declare, for example blc disk driver using: # mkdev hd 0 SCSI-0 0 blc 0but it works for IDE hard disk? (3 Replies)
Discussion started by: ccc
3 Replies

6. AIX

How to increase Virtual Disk size

Hello, I am working AIX VIO server and extended Virtual Disk of one of the Partition with 10GB. After starting partition, i am not able to see increased size of disk. Can you please help me what I need to do to increase the size of virtual disk from partition? Thanks Kishor ... (7 Replies)
Discussion started by: kishorbhede
7 Replies

7. UNIX for Dummies Questions & Answers

Hard Disk at 99% Help!

:eek: I use this Solaris to run CMS a call acounting software package for my job. No one could run reports today because it said the this when you logged on "The following file systems are low, and could adversely affect server performance: File system /: 99%full" Can some one please explain... (9 Replies)
Discussion started by: mannyisme
9 Replies

8. UNIX for Dummies Questions & Answers

How do I increase disk space available to a directory?

I know very basic Unix commands s I would really appreacite the assistance of a Unix guru. I am installing an application on a Sun server, when attempting to install I get an error that says I do not have enough sapce allocated for my install directory. Error says it has 7235m but needs 15360m.... (2 Replies)
Discussion started by: rhack
2 Replies

9. UNIX for Advanced & Expert Users

How can I increase the disk quota for a directory?

I know very basic Unix commands s I would really appreciate the assistance of a Unix guru. I am installing an application on a Sun server, when attempting to install I get an error that says I do not have enough space allocated for my install directory (/ACEMS). Error says it has 7235m but needs... (1 Reply)
Discussion started by: rhack
1 Replies

10. UNIX Desktop Questions & Answers

Hard Disk

I have a cuestion. How Can I to add other hard disk to my computer? I need to configurate anyone? (4 Replies)
Discussion started by: hmaraver
4 Replies
Login or Register to Ask a Question