Jump to content

Resizing my Reiserfs partition [solved]


ianw1974
 Share

Recommended Posts

I need to resize a reiserfs partition, and extend it, but unsure of if there are any GUI tools I can use to do it, or whether it's best done at the CLI.

 

I only know of resize_reiserfs, but wondering if there are any better utilities for this, and what to stay away from using?

Link to comment
Share on other sites

I have done this with harddrake, but I created a larger partition and moved data. If I were to just resize the partition, I would use Partition Magic, since I own a copy! :lol:

Link to comment
Share on other sites

AFAIK Fartition Magic (IMO a very bad program) resizes ext3, but not reiser 3.X

Last version of Acronis partition manager does resize reiser, but since I own the previous version (so far I did not like paying the extra money for upgrade from the previous version) I cannot comment how well it copes with the task.

Link to comment
Share on other sites

Sorry for this long section, but it's explaining what I've done so far up to the point to resize.....

 

I had Partition Magic for Windows, and checked there but it just thinks my partitions are ext2 even though they are reiserfs.

 

I have no other apps to resize, hence the question on any freely available. Some people mentioned trashed partitions using qtparted, so not sure if anyone else has had good/bad experience with this.

 

Now for the reasons. My disk in my work laptop was split with Windows and Mandriva 2006. Windows was originally taking approximately 18GB of space, since I had a lot of apps there that required I use Windows more than Linux. Mandriva was installed in the default method, so you end up with an Extended partition, with my root partition and swap within here. So effectively:

 

/dev/hda1 = Windows = 18GB
/dev/hda2 = Extended Partition
/dev/hda5 = / = 10.5GB
/dev/hda6 = swap = 1GB

 

I had managed to get the main apps required working in Wine (Lotus Notes, Internet Explorer - for timesheet system), and the rest I'm using in VMware Player for support apps. The reason Windows still exists is because we have VMware for Windows, and not for Linux, otherwise it would have been Linux only for me.

 

So, I resized Windows to 8GB, which meant I had a 10GB gap between Windows and hda5. I created a new partition (/dev/hda3) and it's reiserfs. My next task was to boot from the Mandriva DVD and get into rescue mode. I then performed:

 

cp /dev/hda5 /dev/hda3

 

to migrate my data. I then mounted the partition afterwards to check it all made it across successfully. It did, so I therefore deleted /dev/hda2, which subsequently deleted /dev/hda5 and /dev/hda6 which were contained within. I created a swap partition again using the same size as before at the end of the disk, thus leaving a gap between my new root partition and the swap file. I went into Advanced features, to then fix the partition numbering. That meant that /dev/hda3 became /dev/hda2 and the swap partition became /dev/hda3. I chrooted /dev/hda2, edited fstab and reran lilo to update the MBR.

 

The system boots fine, but now I'm just needing to expand into the rest of the disk. Here is my current partition information:

 

Disk /dev/hda: 30.0 GB, 30005821440 bytes
255 heads, 63 sectors/track, 3648 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1044     8385898+   7  HPFS/NTFS
/dev/hda2            1045        2295    10048657+  83  Linux
/dev/hda3            3518        3648     1052257+  82  Linux swap / Solaris

 

So, as you can see, /dev/hda5 began at 2296 and finished at 3517. Now I just need to expand /dev/hda2 to end at 3517. I think resize_reiserfs works by size, rather than by blocks, so makes it a little difficult to try to ascertain the rest of the disk successfully. Any idea/thoughts appreciated, so that I can gain the rest of the disk.

Link to comment
Share on other sites

I resized partitions with partition magic ;)

 

And surprisingly my partition weren't reiserfs or ext2/3 they have all been type 82 or type 83 partitions.

 

And funnily enough all my partition have had filesystems on them

 

Chocolate fish .. goes to the person who guesses what the difference is between a parttion and a file system is.

 

I think what you want is to resize the parttion (fdisk, cfidsk, parttion magic .. etc etc etc) then grow the filesystem (resize_reiserfs)

Link to comment
Share on other sites

Can't seem to find the resize option in fdisk. Maybe it's possible when booting from the Mandriva install CD, and using the resize option in there!

 

Will have a look.

Link to comment
Share on other sites

fdisk is really dangerous to resize.

 

I've resized with cfdisk before, but only on blank partitions that I formatted once resized.

 

I'd go with parttion magic .. or just mount the extra space elsewhere.

 

there's plenty of places that free space can be used .. and / uses bugger all space ;)

you can have plenty of fun with partitioning schemes :D

here's mine (I had fun)

/dev/hda1             973M   51M  923M   6% /boot
/dev/hda3              29G  1.6G   28G   6% /
udev                  1.5G  600K  1.5G   1% /dev
cachedir               29G  1.6G   28G   6% /lib/splash/cache
/dev/hda5              48G   40M   48G   1% /home
/dev/hda6             9.6G  319M  9.3G   4% /var
/dev/hda7             2.9G  177M  2.7G   7% /var/log
/dev/hda8             2.9G   33M  2.9G   2% /tmp
/dev/hda9             4.8G  178M  4.6G   4% /usr/portage
/dev/hda10             29G  3.0G   26G  11% /www
/dev/hda11             29G  451M   29G   2% /mail
/dev/hda12             31G  2.1G   29G   7% /backup
shm                   1.5G     0  1.5G   0% /dev/shm
/dev/hdc1             112G   77G   36G  69% /seraph
/dev/hdd1             112G   43M  112G   1% /mandrivauser

Link to comment
Share on other sites

cfdisk doesn't seem to work on my machine:

 

cfdisk
Segmentation fault

 

this happens when booted into the system normally, or also when booted from single user mode. My partition type is 83, and 82 for the swap. I'll see if I can extend it with Partition Magic. I've copied the data, so worse case is that I trash it and have to reinstall the system!

Link to comment
Share on other sites

Man, what was I worrying about :D

 

I decided to use fdisk in the end, even though it wasn't recommended :P. I figured what cfdisk or Partition Magic could do, I'm sure that fdisk would work relatively the same. The important thing I believe, is to ensure that the partition always begins in exactly the same location. In my case, always beginning at 1045, else I would lose all my data. So, in short, what I did, was boot from Mandriva DVD and then type:

 

press f1
linux rescue
fdisk /dev/hda
delete partition 2
create partition 2, starting at 1045 and finishing at 3517 (swap starts 3518)
write changes
resize_reiserfs /dev/hda2

 

the resize command, without any parameters, basically somehow knew to expand the filesystem to the rest of the partition size.

 

fdisk -l /dev/hda

Disk /dev/hda: 30.0 GB, 30005821440 bytes
255 heads, 63 sectors/track, 3648 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1044     8385898+   7  HPFS/NTFS
/dev/hda2            1045        3517    19864372+  83  Linux
/dev/hda3            3518        3648     1052257+  82  Linux swap / Solaris

 

I then mounted the partition and checked I still had my file system intact. It seemed so. I rebooted the system, and now of course am posting this!

 

Time for a :beer: for me and everyone else too for your input!

Link to comment
Share on other sites

  • 3 months later...

Just posting in here, since I'm just doing another resize, and thought someone else might like the information.

 

My hard disk was partitioned with 20GB allocated to /, and probably, a little too much. I wanted to resize to 10GB.

 

This time, my partitions now are:

 

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot	  Start		 End	  Blocks   Id  System
/dev/sda1			   1		 249	 2000061   82  Linux swap / Solaris
/dev/sda2			 250		1466	 9775552+  83  Linux
/dev/sda3			2682		9729	56613060   83  Linux

 

The resize process was relatively simple. First, had to use resize_reiserfs to reduce the size from 20GB to 10GB:

 

resize_reiserfs -s -10G /dev/sda2

 

This sets the new size to 10GB, because it works by 20GB - 10GB = 10GB. If you had 18GB size, and did -10G, the result would be a partition of 8GB. Alternatively, if you prefer to just say set size = 10GB, then you can use:

 

resize_reiserfs -s 10GB /dev/sda2

 

will basically resize and set to 10GB. This is probably easier and clearer, than attempting to use the decrease by xG in size.

 

Next, I used:

 

fdisk /dev/sda

 

I pressed "d" and then "2" to remove /dev/sda2. Then, press "n" for new partition, "2" again to make sure we have the same device, make sure the start value is the same as previously, else you will lose your data when you write the changes. Then to set the end size I just typed +10000M to set 10GB. Not sure if +10G works in fdisk or not, so this is just as good. I then pressed "w" to save changes, and rebooted, and found everything as I wanted.

 

The filesystem snapshot above shows the partition after the resize. I didn't take a snapshot before the resize. Now, I need to expand /dev/sda3 to use the space before it (see the gap between the end of /dev/sda2 and /dev/sda3 - this shows I've resized and have available disk space). This has to be done in two stages.

 

The first stage is to create another partition using fdisk. So in my case "n", then "p", then "4", creating /dev/sda4 and then use the commands I've previously used in this post, then it gave a message about partitions not being in order, so "x" for expert mode and "f" to fix the partition order. This means my /dev/sda3 became /dev/sda4, and my new /dev/sda4 became /dev/sda3. It's important to note that now your data is on /dev/sda4 because the partition mount point has changed. I then copied the information by doing the following:

 

mkdir /mnt/oldhome
mkdir /mnt/newhome
mount /dev/sda4 /mnt/oldhome (where my data exists)
mount /dev/sda3 /mnt/newhome (where I want my data to move to)
cp -R /mnt/oldhome/* /mnt/newhome

 

of course, you need to make sure that the space in /dev/sda3 doesn't exceed what you need to copy into. Because my /dev/sda3 is about 50GB, and I'm copying into a 10GB partition, means I've had to move my data off onto another machine. I just ftp'd this off, reducing the system to basically user config files since it's my home directory.

 

Following this, you use:

 

resize_reiserfs /dev/sda3

 

to use all available space for reiserfs. And you're all finished :P oh, almost forgot, here is the partition table once finished:

 

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot	  Start		 End	  Blocks   Id  System
/dev/sda1			   1		 249	 2000061   82  Linux swap / Solaris
/dev/sda2			 250		1466	 9775552+  83  Linux
/dev/sda3			1467		9729	66372547+  83  Linux

 

The only last thing to do is reboot into Mandriva and then reset the privileges on the directories for home, since they will all point to root since the move. Therefore, it's a case of, for example:

 

chmod -R admin:admin /home/admin

 

and complete this for each user. You'll have to login as root of course to do this, so just press CTRL-ALT-F1 to get a console screen, and login here to complete. Then ALT-F7 to switch back to the GUI and login as your user as normal.

 

If anyone does this, make sure you have a backup of your system, and should it fail, the CD media to reinstall if it really does go wrong and be able to restore your data.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...