LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 09-16-2005, 05:59 PM   #1
Lagg
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 67

Rep: Reputation: 15
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
 
Old 09-16-2005, 06:04 PM   #2
snakeo2
Member
 
Registered: Mar 2004
Location: Miami, Fl
Distribution: Red Hat 9/fedora core3/
Posts: 273

Rep: Reputation: 30
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
 
Old 09-16-2005, 06:22 PM   #3
rholiday
LQ Newbie
 
Registered: Aug 2005
Location: Wisconsin
Distribution: Ubuntu
Posts: 17

Rep: Reputation: 0
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.
 
Old 09-17-2005, 01:48 AM   #4
Lagg
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 67

Original Poster
Rep: Reputation: 15
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




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


Last edited by Lagg; 09-17-2005 at 01:53 AM.
 
Old 09-17-2005, 02:27 AM   #5
Lagg
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 67

Original Poster
Rep: Reputation: 15
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?




Humm.....
 
Old 09-17-2005, 09:54 AM   #6
snakeo2
Member
 
Registered: Mar 2004
Location: Miami, Fl
Distribution: Red Hat 9/fedora core3/
Posts: 273

Rep: Reputation: 30
Let me know how that works out for you. if i have some time today, i might do something similar
 
Old 09-17-2005, 01:39 PM   #7
Lagg
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 67

Original Poster
Rep: Reputation: 15
Update:

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)
 
Old 09-19-2005, 03:59 AM   #8
Lagg
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 67

Original Poster
Rep: Reputation: 15
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!!!

Last edited by Lagg; 09-19-2005 at 04:03 AM.
 
  


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
how to resize partition with no data loss? jonohana Linux - Newbie 3 11-15-2005 09:20 AM
Resize / partition without loss of data techsimian Linux - Hardware 6 03-19-2005 01:19 AM
Want to split a partition without data loss. Ebel Linux - Hardware 1 08-10-2004 12:56 AM
Resizing ReiserFS without data loss in Slackware 9.1.. ??? crystalmethboy Slackware 2 01-20-2004 01:14 PM
data loss on FAT32-Partition sem2 Linux - General 1 08-02-2003 12:03 AM


All times are GMT -5. The time now is 06:39 AM.

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