ReiserFS: Enlarging sandwiched partition with no data loss
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
ReiserFS: Enlarging sandwiched partition with no data loss
I've looked over some of the reiserfs threads, and I'ved tried some stuff, but nothing seemed to be scratching the itch of what I'm trying to accomplish.
I guess when I was making the partitions, I forgot I indeed had a 70gb drive and not a 40gb drive becuase I have approx 37G of free space.
After a year or so of use, I'm running low on / space and I would like to move some of that free space onto the / partition.
I tried using resize_reiserfs but it says I would have to use cfdisk to delete, then re-create the / partition with the desired size, making sure I use the orginal start cylinders. This would be fine for enlarging the / dir, but how would not totally loose my /home ?
Im having the same problem as you. my root partition is down to 32MB of free space and i'm in desperate need to enlarge said partition. Have you tried booting off Mandrake 10.0 and use the partition program to try to enlarge your partition? I tried it but didnt work. Thats not to say that it wont work for you. make sure you defrag before you do anything. Also you may want to consider "Parted", which accordint to what i've read so far is the by far is one of the most effective methods to resize partitions. im still reading because i want to be comfortable before trying anything. If you find something that works, please let me know. Good luck
1) Make a new new partition from the freespace
2) move(copy) /hda3 (/home) to that new space
3) Delete original location of /hda3
4) Expand / (/hda2) so that it covers the old /hda3 location
5) Call it a day?
Through my I found a program called gparted. Most important part it that it works with reiserFS no problem, no dependencies.
I have the luxury of having a spare hdd (which will be used for completey differnt project, or else I would have just copied everything to it) so I used dd (which I found out about on this forum last night, man I've been using Linux too long to NOT know about the awesomeness of that!) to basically make a copy of the entire HDD onto the spare disk (mbr, swap, the works). Then I used gparted to create a new partition from the freespace (so it's now /hdb4) Then I used dd to copy the /home onto /hdb4 (new space).
after this it was time to resize / (/hda2). After rebooting and making sure my copying of /home went alright (i redid fstab to point /home @ /dev/hdb4) I used gparted to delete the orginal /hdb3 and then moved /hdb2 to fill the gap.
after hitting apply it babbled somthing about cannot change /hda2 but it deleted hda3 just fine, and in the gap, created some "unallocated space". I just deleted that, it changed to "free space", then tried to resize again. It gave me the same lip about cannot change, but it seemed to resize anyhow.
Still copying and what not as we speak, so I'll get back after (it it does) work.
Important thing about this is that I did all of the gparted and dd work from the copied hdd. I would suppose you would have to have a live cd /rescue disk that had programs that worked with reiserFS if you wanted to do this if you only had one disk (I know both of the livecds/rescues I had laying around didn't come with proreiserfs or whatever that library is that allows you do mess with reiserfs so I was SOL)
I'll just bump this because who knows who might find this useful.
again
:my situtation
hda1 (2gb swap)
hda2 (20 gb reiserfs, used 18 gb)
hda3 (20 gb reiserfs, used 12 gb)
~37GB free space.
Running out of room on hda2.
difficulty:
All partitions are reiserFS. Tinkered with Parted, and some with Gparted (which actually works better than parted itself), still no 100% solution w/o using reiser* programs.
Plan:
make a new partiton out of the free space
copy all of hda3 to new partition (hda4).
delete hda3
Reboot using knoppix or any other LiveCD/Rescue that has reiserprogs on it
Then resize hda2 so that it would emcompass the space previously held by hda3
call it a day.
Actions
boot up knoppix/whatever
root console/sudo, whatever that enables superuser/root
cfdisk /dev/hda-> use that to make the freespace a linux partition, DONT MESS WITH ANYTHING ELSE, make sure you write to disk when done.
reboot , keep knoppix/whatever in, you're not done yet
after the reboot, turn back into su/root
mkreiserfs /dev/hda4
mount /dev/hda3 /mnt/foo
mount /dev/hda4 /mnt/bar
cd /mnt/foo
cp -xa * /mnt/bar (will take awhile depending on what you have)
3x check that there is actually infomation (probably best done by editing fstab to point to to hda4 instead of hda3, rebooting into regular Linux, and see if everything works) on hda4
after you've checked that hda4 is a completlely viable partition and functions the exact same as hda3, things get tricky. If you are a person of any faith you may want to reaffirm yourself before you do this.
reboot back into knoppix/whatever
cfdisk /dev/hda
now comes the part that will defy logic:
delete hda3
delete hda2
now in the new freespace that is between hda1 & hda4 create a new linux partition
write to disk.
resize_reiserfs -s +[x]G /dev/hda2 ([x] is size that the disk was enlarged by, it won't let you get bigger than the actual parition is so it will kinda curb you back to the right size if though you enlarged it by 20, and it was really only 19, try 19,18, etc)
write to disk.
reboot back into the regular Linux and hope everything works.
NOTES:
I had the luxury of having a seperate hdd to backup all of my information to so I was able to mess around with this until I got it the way it should have worked in the 1st place.
you'll need some form of a rescue/liveCd/working OS on another hdd for this. This allows you to work in a safe enviroment to manuipulate your hdd in quesiton. I used knoppix, but any disk that has cfdisk, resize_reiserFs, mkreiserFS (somtimes under the progreiserFS or reiserfsprogs umbrella) will do the trick.
if you have a situation where it's somting along the lines of
and you wish use that extra 5 gb that hda3's not using in your hda2, then you'll need some way of backing up/transfering all the information off of hda3, becuase in the case, making a new partition out of the freespace won't work (duh). I'm pretty sure that you can resize hda2 though by deleting, and then recreating, then resizing with resize_reiserfs. You won't want to use mkreiserfs at all (unless you want to delete everything on hda2 as well, which in my case would probably cause a cranial explosion).
THIS WORKED FOR ME ON MY COMPUTER. DO NOT EMAIL OR FLAME ME BECAUSE "OMG IT TOTALLY FUBARD MY BOX!!!" PLEASE, SOMEONE WITH MORE KNOWLEGE THAN I COME AND TRY TO DISCREDIT ANYTHING ABOVE, I BEG YOU!!!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.