Changing Partitions - Existing Linux 3AS install

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.

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 :)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

InternAuthor Commented:
    sda1               1 gig
    sda2               1 gig
    sda3               1 gig
          sda4         11 gigs
          sda5         5  gigs
          sda6         1 gig
    unallocated space - raw device
To provide help on this I need to see what 'df'  and 'fdisk -l /dev/sda' shows.
InternAuthor Commented:
[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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

InternAuthor Commented:
I want to decrease the size of var and increase the size of home
InternAuthor Commented:
[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
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.
InternAuthor Commented:
>>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
Well in that case why not just do 'mkdir /var/backup' and push the data to there?
InternAuthor Commented:
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  

> 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.

InternAuthor Commented:

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

    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.

   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.


Shrinking /usr and giving the space to /var is doable because they are consecutive partitions. Gnu 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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
InternAuthor Commented:
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.
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.
InternAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.