[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Changing Partitions - Existing Linux 3AS install

Posted on 2004-11-09
16
Medium Priority
?
355 Views
Last Modified: 2010-04-20
We need to move some partitions around in our Redhat 3AS box, I need to make some room so that I can manage backups of an Oracle DB.  We tried to boot to partition magic to change the partitions, since we are not Linux savy yet, but when we made any changes to the partions that existed in the Extended partitions then it says that there are bad blocks in Block 8.  Here is a rough sketch of what is going on.

Partions
-----------------------------------------------------------------------------------------------------------------
sda1   /root   /boot   /ext
                                 sda3         sda4       sda5    etc...

we want to change the make one smaller and then take up that free space with another on.  i.e. make sda4 only 1 gig from 11 gigs, and then make sda5 15 gigs from 5.  Not sure if any of that explanation makes sense, but anyway I need to find out houw to either fix the bad blocks that partition magic is finding or make the partition changes in Linux.

Remember I am a Linux novice, so you may have to speak very slowly :)
0
Comment
Question by:Intern
  • 9
  • 5
  • 2
16 Comments
 
LVL 1

Author Comment

by:Intern
ID: 12536270
Partitions
---------------------------------------------------
sda
    sda1               1 gig
    sda2               1 gig
    sda3               1 gig
    ext
          sda4         11 gigs
          sda5         5  gigs
          sda6         1 gig
sdb
    unallocated space - raw device
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12536385
To provide help on this I need to see what 'df'  and 'fdisk -l /dev/sda' shows.
0
 
LVL 1

Author Comment

by:Intern
ID: 12536412
[oracle@oracledb oracle]$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda7              2528720   1495968    902228  63% /
/dev/sda3               248895     21892    214151  10% /boot
none                   4099792         0   4099792   0% /dev/shm
/dev/sda8              1268216     33612   1169144   3% /tmp
/dev/sda5             12332736   2512720   9183444  22% /usr
/dev/sda6             12340376    142816  11560588   2% /var
/dev/sda2              3166776     36076   2967240   2% /home
[oracle@oracledb oracle]$ fdisk -l /dev/sda
Cannot open /dev/sda
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:Intern
ID: 12536427
I want to decrease the size of var and increase the size of home
0
 
LVL 1

Author Comment

by:Intern
ID: 12536461
[root@oracledb oracle]# fdisk -l /dev/sda
 
Disk /dev/sda: 36.3 GB, 36364615680 bytes
255 heads, 63 sectors/track, 4421 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot    Start       End    Blocks   Id  System
/dev/sda1             1         5     40131   de  Dell Utility
/dev/sda2             6       412   3269227+  83  Linux
/dev/sda3   *       413       444    257040   83  Linux
/dev/sda4           445      4420  31937220    f  Win95 Ext'd (LBA)
/dev/sda5           445      2029  12731481   83  Linux
/dev/sda6          2030      3615  12739513+  83  Linux
/dev/sda7          3616      3940   2610531   83  Linux
/dev/sda8          3941      4103   1309266   83  Linux
/dev/sda9          4104      4420   2546271   82  Linux swap
[root@oracledb oracle]#

Sorry forgot to run this as root
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12536640
Because /home is a primary partition any adjustments in it will require changes to sda3-sda9. It is possible to do this but it will require a full system dump, re-partitioning, and restore of everything. An alternative to that would be to symlink a directory in /var or /usr where there's plenty of space (9-11GB free) to where you need the space to show up in /home.

It is possible that there aren't any bad blocks on the disk. PartitionMagic may just not like the Dell Utility partition (sda1). Certainly block 8 that it complains about lies within that partition.
0
 
LVL 1

Author Comment

by:Intern
ID: 12536698
>>An alternative to that would be to symlink a directory in /var or /usr where there's plenty of space (9-11GB free) to where you need the space to show up in /home

Could you help me in doing this...  Really we don't care where the extra space is.  It would probably be even better to free up a bunch of space and just create a partition on that free space called "/backup" or something like that.

Really we just need a folder on the filesystem that has alot of free space, it does not matter where the free space comes from.  I just want to be able to dump full database backups to the disk without filling it.  They have to be on sda, since sdb is where the actuall database resides and we need another layer of redundancy on top of the hardware RAID.

Thanks for helping
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12537164
Well in that case why not just do 'mkdir /var/backup' and push the data to there?
0
 
LVL 1

Author Comment

by:Intern
ID: 12537402
That will work for us, but I would like to make the var directory bigger, right now there is 11 gigs free, and there are 9 gigs free in the /usr directory.

/dev/sda5             12332736   2512720   9183444  22% /usr
/dev/sda6             12340376    143940  11559464   2% /var


How can I shrink the /usr directory to only have 1 to 2 gigs free, and add that extra space to the /var directory so that we can have more space to work with on the same partition.  So I would like it to look like this:

partition                               free space
----------------------------------------------
/dev/sda5             ???   ???   2183444  
/dev/sda6             ???   ???  20559464  
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 12537618
Hi,

> make sda4 only 1 gig from 11 gigs
sda4 is the extension partition which includes dsa5, sda6, sda7, sda8 ...
You can not resize it without delet it.

Anyway, for moving Oracle DB, all you need to do is (as root)
# mkdir -p /var/oracle_bak  /usr/oracle_bak
And ask your Oracle DBA (Database Administrator) to dump the DB into those 2 directories separately.
Then you can backup those 2 directories.

Wesly
0
 
LVL 1

Author Comment

by:Intern
ID: 12537633
>>wesly_chen

Please read my last post, BTW - I am one of the DBA's, just new to linux
0
 
LVL 38

Assisted Solution

by:wesly_chen
wesly_chen earned 800 total points
ID: 12537942
Hi,

    My browser didn't update when the content of webpage change. So I didn't see your post before the last post.

    For resizing sda5 and sda6, you can use "parted" in RedHat Linux.
Please read the following document (chapter 5 : Managing Disk Storage) very carefully.
http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/pdf/rhel-sag-en.pdf

   Also, backup all the important data on /usr and /var to tape first. Then boot from CD-ROM into "rescue mode" (type "linux
rescue" when boot from CD-ROM) to run "parted".

   For details, please read chapter 5 in that document.

Regards,

Wesly
0
 
LVL 40

Accepted Solution

by:
jlevie earned 1200 total points
ID: 12538143
Shrinking /usr and giving the space to /var is doable because they are consecutive partitions. Gnu parted (http://www.gnu.org/software/parted/) might be able to handle this. Or you could backup /usr & /var, boot into rescue mode from CD, use fdisk to adjust the start/end of partitions 5 & 6, make new file systems, and restore the data from backup.

Whether you use parted or the manual process please make sure that you have a full system backup first.
0
 
LVL 1

Author Comment

by:Intern
ID: 12538160
Thanks for the comments.  We are checking to see if the Partition Magic problem is because we restored the server from a Ghost Image.  It may have corrupted the partition table.

Anyway, I will get back to you as soon as I can, and if I have to I will use the parted command.  Thanks for the advice.  If I do not get back to you in a few days, just post a note to remind me and I will split the points up accordingly.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12539154
Okay, but please, please, please, do a full backup before touching the partition table. Since you've used Ghost and since PartitionMagic wasn't happy with what it saw there's a real risk that changing the partition table could result in a total loss.
0
 
LVL 1

Author Comment

by:Intern
ID: 12539335
Not really a problem to loss all the data, we have blown away the server time and time again.  We are still in the testing phase of the Oracle DB.  I have modified the partitions on the most recent install so hopefully it won't be a problem anymore.  I think the problem is that Ghost is messing up the partitions.

Thanks for the help.  I am sure to use this information later.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month19 days, 19 hours left to enroll

873 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