shrinking reiserfs partitions, filesystems

Chris Tyler chris at tylers.info
Wed Mar 4 19:48:23 UTC 2009


On Wed, 2009-03-04 at 10:45 -0800, jackson byers wrote:
> 
> I had thought that the size of a filesystem was just the amount
> of stuff in there as given by df in the Used column
> eg on my external usb /dev/sdc1  which is one large reiserfs partition
> [root at bootp ~]# df -kh
> Filesystem            Size  Used Avail Use% Mounted on
> ...
> /dev/sdc1             233G   16G  218G   7% /media/disk-1
> 
> so, to me that meant the "size of the filesystem" was given in Used =
> 16G
> but it now seems that is wrong? ie 
> "size of the filesystem" is actually the entire diskpartition =233G ?

Yes, in this case the filesystem is 233G, of which 16G is used.
Presumably the filesystem fills the partition.


> so if I want to shrink dev/sdc1 partition down to 50G
>  I must 
> 1) shrink the filesystem first using resize_reiserfs also to 50G ?
> 2) then use cfdisk to shrink the partition to 50G ?

Yes. However, you should be wary of rounding -- because the allocation
units vary between layers, it's best to:

1) shrink the filesystem down to a size somewhat smaller than the final
size desired, but larger than the space in use.

2) shrink the container (partition in your case, or logical volume if
using LVM) using one of the partitioning tools

3) grow the filesystem to fill the container


> If that is correct, will I retain or lose my current data in that 16G
> Used?

On a Good Day, you'll retain it. (Back up your data, of course: any data
put on a hard disk is guaranteed to be lost. The only question is
when!).


> Is it easier/better to use parted,gparted... for shrinking reiserfs
> partitions?

gparted is designed to handle filesystems as well as partitions, so a
single graphical tool can do it all. 

If this filesystem is in use, it can't be shrunk using current tools. If
it's not an essential-to-the-system filesystem (e.g., /data or
something) you can unmount it and resize it; if it's essential but not
the root filesystem (such as /home), you can boot into single-user mode
and work there; or you can, in all cases, boot from another medium such
as a CD or USB flash drive so the filesystem is not in use. The gparted
bootable disc (http://gparted.sourceforge.net/livecd.php) or a Fedora
live disc can be used for this (not sure if reiserfs tools are on the
Fedora live disc, though).

-Chris




More information about the fedora-list mailing list