[vox-tech] first shot with parted

Peter Jay Salzman vox-tech@lists.lugod.org
Fri, 26 Jul 2002 00:46:48 -0700


when i first installed debian, i was still kind of new-ish to the
partitioning thing and made /var much too small:

Filesystem            Size  Used Avail Use% Mounted on
/dev/hda5             6.4G  5.2G  997M  85% /
/dev/hda1              15M  7.5M  6.9M  52% /boot
/dev/hda2             188M  133M   55M  71% /var
/dev/hda3             128M                  swap
/dev/hda6             7.5G  4.6G  2.8G  62% /usr/local
/dev/hda7             4.8G  3.8G  1.0G  78% /home
/dev/hdb1             128M                  swap
/dev/hdb2              25G  (unused space)
/dev/hdc1             128M                  swap
/dev/hdc2              73G   19G   50G  28% /data

/var was turned into a reiser partition somewhere along the way.  sarge
got a _huge_ update today, and i had to update piecemeal because there
wasn't enough room on /var (the other option was to copy /var to /data
and create a symlink to it).  that just sucked, i swore that i'd do
something about it tonight.

the plan was to combine /dev/hda2 (/var) and /dev/hda3 (swap).

after reading some docs, i found that i had to install a library for
reiser support for parted, which i did.

parted still complained that it couldn't handle reiser.  google
searching didn't yeild much info.  the README had nothing.  a quandry.

so in an act of desperation, i installed parted along with all its
dependencies and suggestions from unstable.  THIS time, parted
acknowledged the reiser libs.  but not the way i wanted it to:

  satan# parted
  Warning: GNU Parted has detected libreiserfs interface version mismatch.
  Found 1-1, required 0. ReiserFS support will be disabled.

oh well.  i wanted to do this the elegant way, instead i'll use brute
force.  i archived /var and put an ext3 filesystem over it.

   fuser -k -m /dev/hda2
   swapoff /dev/hda3
   parted /dev/hda

here's what parted sees:

   Minor    Start       End     Type      Filesystem  Flags
   1          0.031     15.688  primary   ext3        boot
   2         15.688    203.950  primary   ext3    
   3        203.950    329.458  primary   linux-swap
   4        329.458  19571.374  extended
   5        329.489   7004.904  logical   ext3
   6       7004.936  14637.348  logical   reiserfs
   7      14637.379  19571.374  logical   reiserfs

i deleted the swap partition:

   rm 3

and then resized /var:

   resize 2 15.688 329.458

believe it or not, that's it.  here's what parted now sees:

   Minor    Start       End     Type      Filesystem  Flags
   1          0.031     15.688  primary   ext3        boot
   2         15.688    329.458  primary   ext3
   4        329.458  19571.374  extended
   5        329.489   7004.904  logical   ext3
   6       7004.936  14637.348  logical   reiserfs
   7      14637.379  19571.374  logical   reiserfs

looking at df -h, /var is still on the smallish side

   Filesystem            Size  Used Avail Use% Mounted on
   /dev/hda5             6.4G  5.2G  993M  85% /
   /dev/hda1              15M  7.4M  6.9M  52% /boot
   /dev/hda6             7.5G  4.6G  2.8G  62% /usr/local
   /dev/hda7             4.8G  3.8G  1.0G  78% /home
   /dev/hdc2              73G   20G   50G  28% /data
   /dev/hda2             304M   97M  192M  34% /var

but at least i have some breathing room now.  ideally, i would've liked
for it to be about 500M.  as long as i keep apt-get cleaning and
rotate logs a bit faster than normal, i should be fine.

parted was surprisingly easy to use.  for my next trick, i'd like to 
shave off a bit from hda6 or hda7 to make a swap partition on hda, but i
need to read the docs a little bit more for that.

ideally, i'd like to have /var bigger by a few hundred MB.  i don't
think that's going to happen just yet.  i may have read the docs
incorrectly, the the docs seemed to indicate that a partition's start
location isn't allowed to move for ext2 and ext3.  that allows you to
combine and split ext2/ext3 partitions, but not resize.

if someone has used parted and knows this is wrong, please let me know.

i have 25 GB of unused space; i may just make a 500MB /var on that.  i
still don't know what to do with the rest of the 24.5 GB.  but then what
do i do with my newly resized hda2?  i'd *like* to give it to the root
partition since hda2 and hda5 are physically right next to each other.
but that would mean changing the start block for hda5, and supposedly
parted can't do that for ext2/3.

pete

ps- i forgot one last step.  after you change the partition geometry,
you most likely need to edit fstab.

whew

-- 
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D