LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 11-23-2008, 09:59 AM   #1
centguy
Member
 
Registered: Feb 2008
Posts: 394
Blog Entries: 1

Rep: Reputation: 35
how to remove disk space in /dev/sda8 to increase the /dev/sda7


I have an embarassing situation here:
Quote:
[root@centos52-64-dell ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda7 6348988 5376336 644928 90% /
tmpfs 1024532 0 1024532 0% /dev/shm
/dev/sda3 40313996 28289452 9976660 74% /sda3-C4.5-slash
/dev/sda6 14428928 10420296 3275668 77% /sda6-C4.5-home
/dev/sda8 5679848 4474704 911960 84% /sda8
As you can see, my /dev/sda7's / is almost filled to the brim, and
I don't need the space in /dev/sda8.

How can I remove /dev/sda8 and increase the disk space for /dev/sda7 ?

Thanks for your help.
 
Old 11-23-2008, 10:41 AM   #2
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by centguy View Post
I have an embarassing situation here:

As you can see, my /dev/sda7's / is almost filled to the brim, and
I don't need the space in /dev/sda8.

How can I remove /dev/sda8 and increase the disk space for /dev/sda7 ?

Thanks for your help.
Unfortunately, I don't know opensource tools that allow in-place disk resize (i.e. you can resize partitions with cfdisk, but you'll have to store/backup all data (from BOTH partitions or at least from /dev/sda8 if you are trying to delete it) somewhere first). But you can always move some folders from /dev/sda7 to /dev/sda8 and replace them with symlinks.

Last edited by ErV; 11-23-2008 at 10:43 AM.
 
Old 11-23-2008, 11:30 AM   #3
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
Many robust disk tools have the ability to slide partitions (with warnings of course, back up the contents of the partition before sliding).
With open source file systems I use Gparted who's version number according to CVS makes it unstable, but appears to work without issues on open source file systems, for proprietary file systems like Microsoft I use a stable software called bootitng.
With either of these you can delete /dev/sda8, slide the partitions after /dev/sda7 over to take up the free space left by /dev/sda8 (with Gparted you may be required to expand the adjacent partition to take up the space, then re-size back to original size to put the free space on the other side of the partition), then when the free space is after /dev/sda7, re-size (expand) it to take up the free space.
 
Old 11-23-2008, 11:51 AM   #4
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
There is a bootable CD called Rescue System CD. I would boot up with that and do the following. Backup ALL Data first. I would shrink the sda8 as you need but from the end of the partition. Then move the entire sd8a partition to the end of the newly free space. Then expand the sda7 partition as needed. Now one can shrink from front to the end but some filesystems cannot handle this well. I just feel better doing this way so the first portion of the partition is not changed as for the least amount of change that does happen.

BUT BACKUP DATA IF IMPORTANT. IT IS NOT 100% GAURANTEED. ONE CAN HAVE A POWER FAILURE IN THE MIDDLE OF DATA MOVING AND TRASH THE ENTIRE SYSTEM.

Brian
 
Old 11-23-2008, 12:10 PM   #5
fubar121
LQ Newbie
 
Registered: Oct 2008
Posts: 3

Rep: Reputation: 0
I just did exactly what you are trying to do with gpartd work flawlessly
 
Old 11-23-2008, 12:38 PM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,040

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
There's a gparted livecd as well. A quick googleing should reveal it.
 
Old 11-23-2008, 08:02 PM   #7
centguy
Member
 
Registered: Feb 2008
Posts: 394
Blog Entries: 1

Original Poster
Rep: Reputation: 35
thanks for the replies. I wonder if I can boot to CentOS 4.5 system (which has nothing to do with /dev/sda7 and /dev/sda8) and then issue a gparted -like program. Now, I wonder if it is easy to install gparted on CentOS 4.5. If this is easy, I can backup /dev/sda7 easily and destroy /dev/sda8 without having to look for the right CD.
 
Old 11-23-2008, 08:09 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,318

Rep: Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033
Before you start, you need to make sure the space is contiguous - run this as root from a terminal and post the results
Code:
fdisk -l

Last edited by syg00; 11-23-2008 at 08:11 PM.
 
Old 11-23-2008, 08:28 PM   #9
centguy
Member
 
Registered: Feb 2008
Posts: 394
Blog Entries: 1

Original Poster
Rep: Reputation: 35
This is my home computer and I don't have access to it right now.
Anyway, I am sure that /dev/sda7 and /dev/sda8 are contiguous, since
the combined space is small and I just experiment with x86_64 and i386 and decided that x86_64 seems better (and have been putting more and more things in that partition).

Now, that I would like to back up /dev/sda7 (the whole CentOS5.2 is on that partition, including /boot,/home,...) before I do anything.

Can I mount /dev/sda7 and then issue a command (from a system in /dev/sda2, of course)
tar -cvf sda7-back-up.tar /dev/sda7/* ?

The idea is if for some reason i screwed up something, I can retrieve the whole thing by
tar -xvf sda7-back-up.tar

If someone can confirm this is the right step I would give it a go..
hey, may be I experiement with the unwanted /dev/sda8 first..

wonder if LVM is of any use to solve my problem here.
 
Old 11-23-2008, 09:05 PM   #10
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by centguy View Post
Can I mount /dev/sda7 and then issue a command (from a system in /dev/sda2, of course)
tar -cvf sda7-back-up.tar /dev/sda7/* ?
You can, but I think you might need to take some precautions. Read something like this or google for linux tar backup.
 
Old 11-24-2008, 06:13 AM   #11
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,040

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
You can use gparted without problems from CentOS. Gparted itself will refuse to work on any partition that's not unmounted, so don't worry about that.


Quote:
Originally Posted by centguy View Post
This is my home computer and I don't have access to it right now.
Anyway, I am sure that /dev/sda7 and /dev/sda8 are contiguous, since
the combined space is small and I just experiment with x86_64 and i386 and decided that x86_64 seems better (and have been putting more and more things in that partition).
That will easy the things.

Quote:
Now, that I would like to back up /dev/sda7 (the whole CentOS5.2 is on that partition, including /boot,/home,...) before I do anything.

Can I mount /dev/sda7 and then issue a command (from a system in /dev/sda2, of course)
tar -cvf sda7-back-up.tar /dev/sda7/* ?
Yes. But make sure that:
  • You mount read only the partition you are baking up. If the contents change while you are doing the backup you might end with an useless tarball. This will also take rid of the stuff like /dev and /proc, so you don't have to use --exclude's.
  • Make sure you test the tarball after creating it, tar -t can do that. Non-tested backups are the best way to cry after a failure.

Quote:
wonder if LVM is of any use to solve my problem here.
LVM is supposed to ease these things. However that will not help you right now. It could help if you were already using it on your volumes. However I never used it. Really never had a need to.
 
Old 11-24-2008, 07:05 AM   #12
centguy
Member
 
Registered: Feb 2008
Posts: 394
Blog Entries: 1

Original Poster
Rep: Reputation: 35
Quote:


* You mount read only the partition you are baking up. If the contents change while you are doing the backup you might end with an useless tarball. This will also take rid of the stuff like /dev and /proc, so you don't have to use --exclude's.
* Make sure you test the tarball after creating it, tar -t can do that. Non-tested backups are the best way to cry after a failure.
Question: I don't think the content of a partition can change if it is not mounted, so I don't have to worry too much about that point right?

How to mount read only a partition, as suggested by you ?
mount -readonly or something ? To make my life simpler, can you write the full command ?

tar -t ? I thought there are just tar -c for create and tar -x for extract.
I will read the man page for this.

Anyway, I cannot install gparted using yum on CentOS4.5 (ironically I can yum install gparted on the newer CentOS5.2). May be I will have to use a livecd after all.

Thanks!!
 
Old 11-24-2008, 08:05 AM   #13
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,040

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Quote:
Originally Posted by centguy View Post
Question: I don't think the content of a partition can change if it is not mounted, so I don't have to worry too much about that point right?
Right, except that if you don't mount it you can't see the files that are inside of it. Hence, you need to mount it to be able to tar the files that live inside.

Quote:
How to mount read only a partition, as suggested by you ?
mount -readonly or something ? To make my life simpler, can you write the full command ?
Code:
mount -o ro /dev/whatever /mountpoint
Though this entirely depends on the file system you use. Check the fstab and mount man pages for more info.

Quote:
tar -t ? I thought there are just tar -c for create and tar -x for extract.
I will read the man page for this.
The man page is a good place to start indeed. -t will test the contents of the tarball and will output errors if the contents is not consistent in some way.

Quote:
Anyway, I cannot install gparted using yum on CentOS4.5 (ironically I can yum install gparted on the newer CentOS5.2). May be I will have to use a livecd after all.

Thanks!!
I guess you could download a statically linked version of gparted on a tarball and uncompress in the /root home dir and use it from there. However, using a livecd is equally valid and probably simpler.
 
Old 11-26-2008, 07:03 AM   #14
centguy
Member
 
Registered: Feb 2008
Posts: 394
Blog Entries: 1

Original Poster
Rep: Reputation: 35
I am not a burning-CD person (an excuse for being lazy and try to save some earth resources).Where can I find the statically link gparted that can run on
CentOS 4.5 ?
 
Old 11-26-2008, 07:26 AM   #15
centguy
Member
 
Registered: Feb 2008
Posts: 394
Blog Entries: 1

Original Poster
Rep: Reputation: 35
On CentOS 5.2, tar -t anyfile.tar
seems to hang for some reason..
It is normal ?
 
  


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
Move /dev/hda2 to end of disk and grow /dev/hda1 bcg121 Linux - Software 4 11-09-2007 09:51 PM
ALERT! /dev/sda7 does not exist. Dropping to shell! eye2eye Ubuntu 2 07-31-2007 10:42 AM
[SOLVED] system disk moves from /dev/sda to /dev/sdm gdevaucorbeil Linux - Hardware 4 03-10-2007 09:30 AM
Need to add a disk space to my cluster that is on SAN (/dev/dm-*) chrysek Red Hat 1 01-02-2007 12:56 PM
root=/dev/sda7 winxshadi76 Linux - Hardware 0 12-10-2004 03:25 AM


All times are GMT -5. The time now is 08:18 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration