how to remove disk space in /dev/sda8 to increase the /dev/sda7
Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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:
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.
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.
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.
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
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.
* 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.
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.
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 ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.