LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ReiserFS: Enlarging sandwiched partition with no data loss (https://www.linuxquestions.org/questions/linux-newbie-8/reiserfs-enlarging-sandwiched-partition-with-no-data-loss-364030/)

Lagg 09-16-2005 04:59 PM

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 have a 70gb HDD with 3 partitions

1 swap /dev/hdb1
20gb / -reiserFS /dev/hdb2
20gb /home -rieserFS /dev/hdb3


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 ?


any help much appresiated!


Lagg

snakeo2 09-16-2005 05:04 PM

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

rholiday 09-16-2005 05:22 PM

It has been a while since this was last asked, but perhaps this link will answer the question for anybody who runs into it.

http://www1.linux-mag.com/content/view/1395/2209/

You will have to register an account, but it is free and you will find additional information that may be useful.

Lagg 09-17-2005 12:48 AM

I'll do some good research tonight, and although I hate to register for anything, I'll give that link a look.

I do realize that this could have been prevented if I would have just done some better partition planning (and paying attention! )

but for now

:study:


EDIT:

After checking out http://www.gnu.org/software/parted/parted.html I dont' think that GNU's Parted program will do the trick

Quote:

Notes:

1. The start of the partition must stay fixed.
so much for that path , not to saying that I couldn't use it do to some harcore create/copy/resize/re-fstab-ardry though...hummm

:study:

Lagg 09-17-2005 01:27 AM

Okay, to spam/bump my post

I think I have a plan


use Parted to

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?


:scratch:

Humm.....

snakeo2 09-17-2005 08:54 AM

Let me know how that works out for you. if i have some time today, i might do something similar

Lagg 09-17-2005 12:39 PM

Update:

Through my :study: 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)

Lagg 09-19-2005 02:59 AM

UPDATE/FINAL SOLUTION


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

hda1 (swap)
hda2 (20gb, 19 gb full)
hda3 (20gb, 15 gb full)
no freespace

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


All times are GMT -5. The time now is 09:55 AM.