Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Other Things Gentoo
  • Search

Shrinking Reiserfs Partition

Still need help with Gentoo, and your question doesn't fit in the above forums? Here is your last bastion of hope.
Post Reply
Advanced search
10 posts • Page 1 of 1
Author
Message
JoeDuncan
Tux's lil' helper
Tux's lil' helper
Posts: 87
Joined: Fri Jun 04, 2004 11:26 am
Location: Ottawa, Ontario

Shrinking Reiserfs Partition

  • Quote

Post by JoeDuncan » Mon Dec 05, 2005 3:20 am

Ok, this is the situation. I have a 100GB reiserfs "/home" partition, that I want to reduce to make room to install a second OS (Debian, Kubuntu whatever I feel like at the time). Now I have about 60GB of stuff on that partition that I don't want to lose, and I don't have 60GB of excess space elsewhere that I can store it while re-partitioning.

So, I need someway to shrink the partition while keeping the data. I've backed up everything I could (all the essentials - settings, personal documents etc...) so all that I'll lose if the partition goes south is my MP3s, AVIs and MPGs. While this isn't critical, I'd prefer to keep them if I can.

I've merged "reiserfsprogs", "parted" and "qtparted". From everything I have read (in this forum and elsewhere), this is all I should need for resizing the partition, as "qtparted" is a gui for "parted" which uses "resize_reiserfs" (from "reiserfsprogs") to resize the filesystem and then shrinks the partition to match.

Ok, no prob. They all merged fine.

I log off as my normal user, log in as root, unmount "/home" and run "qtparted". Only problem is, it doesn't offer an option to resize the reiserfs partition! Again, all the threads I've found in this forum say that this is all I need to do.

I've also tried running parted from the command line, but all it says is:

"No Implementation: Support for opening reiserfs file systems is not implemented yet."

The versions I have installed on my system are:

reiserfsprogs-3.6.19
parted-1.6.23
qtparted-0.4.4

Am I using the wrong versions or something?

Other things I have tried:

-loading Knoppix 4.0 and running "qtparted" from there ==> same results
-loading Kubuntu LiveDVD and running "gparted" ==> this allows me to resize the partition and after I commit the changes it advises me to reboot. After the reboot the partitions are as they were before.

Please do not tell me to move my files to another drive, wipe the partition and create two new ones, reformat etc... I have nowhere to put the data (e.g. I do not have another drive, nor a hundred bucks to drop on one at the moment)

I have also seen suggestions to resize the filesystem with "resize_reiserfs" and then use "fdisk" or "cfdisk" to resize the partition, but this seems a little sketchy to me. How do you make sure the file system and partition start and end in exactly the same places?

Thanks!
Top
Deepak420
Apprentice
Apprentice
User avatar
Posts: 173
Joined: Wed Jan 12, 2005 4:50 am
Location: Beantown

  • Quote

Post by Deepak420 » Mon Dec 05, 2005 3:45 am

You don't really need to use QTparted.

It's as simple as:

Code: Select all

resize_reiserfs -s -?G /dev/hd?
Note the new size using df and cfdisk the partition size down making sure that it 's equal to or greater than the new size.
In fact, I think that QTparted just calls resize_reiserfs rather than reinventing the wheel. Just make sure you triple check your new partition size before writing the new size.
Top
JoeDuncan
Tux's lil' helper
Tux's lil' helper
Posts: 87
Joined: Fri Jun 04, 2004 11:26 am
Location: Ottawa, Ontario

  • Quote

Post by JoeDuncan » Mon Dec 05, 2005 4:50 am

Sure, but as I said, how can you be sure to have *exactly* the same size for the partition you either create or resize with fdisk/cfdisk? Seems fishy to me...

Do "df", "resize_reiserfs" and "fdisk" or "cfdisk" all use the same definitions for Kb, Mb and Gb? Do any of them round?
Top
Deepak420
Apprentice
Apprentice
User avatar
Posts: 173
Joined: Wed Jan 12, 2005 4:50 am
Location: Beantown

  • Quote

Post by Deepak420 » Mon Dec 05, 2005 12:53 pm

Well, the precision of resize_reiserfs isn't a big issue (unless you NEED to be exact at byte level which is unlikely). So it's safe to use the ?G (for ? GiB) size denotation. For df and cfdisk, df does 1024 byte (KiB) units and cfdisk does 1024x1024 (MiB) units so the real critical issue is ensuring that when creating the table that you do equal to or larger than the space returned by df (probably makes more sense now why the resize_reiserfs doesn't need to be as exact). I've successfully done this with both my root drive and one of my storage drives so from my experience it is safe. If you do feel unsure about any round-off you can pad the partition table value by a tenth of a MiB larger than what your calculations evaluate to, which would be tremendously larger than any round off error that would manifest in the situation.

Hope that helps.
Top
JoeDuncan
Tux's lil' helper
Tux's lil' helper
Posts: 87
Joined: Fri Jun 04, 2004 11:26 am
Location: Ottawa, Ontario

  • Quote

Post by JoeDuncan » Mon Dec 05, 2005 2:53 pm

Yeah, it does. I've read through the respective man pages carefully, and I'm sure I can get the sizes close enough.

One more question though, the partition I want to resize is primary partition 4, can I delete it, create an extended parition, then create two parititions inside that, one covering my reiserfs and the other free (my new 20GB partition) to do with as I will?

It seems this would overwrite the first sector of my old primary partition 4 with the partition table of the extended partition. Is there anyway to move my entire reiserfs up one sector on the disk? (i.e. bump all the files one sector further down - thus making room for the extended partition table).

Thanks!
Top
Deepak420
Apprentice
Apprentice
User avatar
Posts: 173
Joined: Wed Jan 12, 2005 4:50 am
Location: Beantown

  • Quote

Post by Deepak420 » Mon Dec 05, 2005 3:20 pm

AFAIK there isn't any safe/easy way of doing what you want there without copying to some temporary space, redoing the partitioning scheme and recopying.
Top
JoeDuncan
Tux's lil' helper
Tux's lil' helper
Posts: 87
Joined: Fri Jun 04, 2004 11:26 am
Location: Ottawa, Ontario

  • Quote

Post by JoeDuncan » Mon Dec 05, 2005 3:51 pm

Hrm... I've just been reading up on ReiserFS, ( http://homes.cerias.purdue.edu/~florian ... iserfs.php http://lwn.net/1999/1202/a/reiserfs.html ) and it seems like it leaves the first 64k of the filesystem empty to leave space for "for partition labels or boot loaders".

If the extended partition only needs the first sector (usually 512 bytes no?), then shouldn't this work?

So:

-unmount partition
-resize filesystem with "resize_reiserfs"
-load disk in fdisk
-delete primary partition 4
-create extended partition 4
-create logical partition 5 (80GB)
-create logical partition 6 (20GB)
-save partition changes

If the above info is correct then "resize_reiserfs" should make sure all the files are within the space that will be occupied by logical partition 5.

Then, when the extended partition is created, it will create it's partition table in the first 512 bytes of the ResierFS, however, if the first 64k of the ReiserFS are blank anyways, then this shouldn't matter?

So, am I nuts?
Top
Deepak420
Apprentice
Apprentice
User avatar
Posts: 173
Joined: Wed Jan 12, 2005 4:50 am
Location: Beantown

  • Quote

Post by Deepak420 » Mon Dec 05, 2005 4:22 pm

It seems like a reasonable assertion, still I don't think I can recall hearing of someone trying it. I'd recommend recreating the situation with a flash drive or some removable media before you try this on your data. I am interested in knowing if it would work, keep us informed.
Top
JoeDuncan
Tux's lil' helper
Tux's lil' helper
Posts: 87
Joined: Fri Jun 04, 2004 11:26 am
Location: Ottawa, Ontario

  • Quote

Post by JoeDuncan » Tue Dec 06, 2005 12:37 am

Ok, some weirdness.

I backup up my 512Mb USB flash drive, wiped it and deleted all partitions. I then created a single primary partition and formatted it with ReiserFS. I copied over about 200Mb of data, and shrunk the filesystem by 164Mb with "resize_reiserfs".

Next, I opened up fdisk, deleted the primary partition, created an extended partition and two logical partitions within that, one the same size as my shrunken ReiserFS. The other filling up the rest of the space.

I then tried to mount the logical partition, but it didn't work :( Complained about being unable to find the superblock.

So, I went back to fdisk, deleted all the partitions again and recreated the single primary partition. After that I was able to mount and use the filesystem ok, and my files were fine.

Very strange. Creating the extended partition didn't seem to damage the ReiserFS (or its superblock), so that would seem to verify that ReiserFS leaves a blank space at the beginning. But then why couldn't I mount the ReiserFS if it was perfectly fine and residing within the logical partition?

Makes me wonder about a couple of things. Are sector sizes on USB drives guaranteed to be 512b?

It seems the problem was this: ReiserFS *always* looks for the super block beginning at byte 65536 of the partition. Now if that's where it was on the original partition, and the new extended partition takes the first sector as its partition table, then the superblock is actually going to be at byte 65024 of the new logical partition. Damnit.

Leaves me at a bit of a loss about what to do with my HD though...

I'm going to try to use "reiserfsck" on the USB drive to rebuild the super block in my logical partition and then rebuild the file tree and see what happens...
Top
JoeDuncan
Tux's lil' helper
Tux's lil' helper
Posts: 87
Joined: Fri Jun 04, 2004 11:26 am
Location: Ottawa, Ontario

  • Quote

Post by JoeDuncan » Tue Dec 06, 2005 2:28 pm

Well, that didn't work. After creating the extended partition on my USB drive and then attempting to repair the ReiserFS with "--rebuild-sb" and "--rebuild-tree" I could mount the ResierFS, but all that was in it was "lost+found" full of a lot of garbage.

End result ==> FS totally borked.

Well, I do have a spare 40Gb lying around, so I've trashed 30Gb of videos & music (guess I'll be spending a lot of time running Azureus after this), now I should be able to backup everything left on that 40 gigger and do this right.

Thanks for all the help!
Top
Post Reply

10 posts • Page 1 of 1

Return to “Other Things Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic