Google Answers Logo
View Question
 
Q: Remotely Resizing Partitions in Redhat 7.1 or 7.2 ( Answered,   5 Comments )
Question  
Subject: Remotely Resizing Partitions in Redhat 7.1 or 7.2
Category: Computers > Operating Systems
Asked by: j2geek-ga
List Price: $5.00
Posted: 16 May 2002 06:58 PDT
Expires: 23 May 2002 06:58 PDT
Question ID: 16557
How do you *remotely* (using telnet or ssh) resize a partition on a
harddrive w/ an ext3 file system running RedHat 7.1 or 7.2?  I have a
remote server, and do not have access to a local console.  It has one
giant root (/) partition, and i need to change the partitioning scheme
of the drive.
Any instructions or tools that you can provide would be most
appreciated!!!

Request for Question Clarification by philip_lynx-ga on 17 May 2002 02:47 PDT
I am sorry to say: You are kind of hosed (and since people don't like
to pay for negative answers, you get this as a clarification request).
I am not aware of any Linux program that is able to split ext2 (or
ext3) partitions on the fly. And I have looked hard and long, believe
me. Partition Magic is nice, but does not run on Linux. Now, you can
trick your system into submission. But it will be hairy.

1) Do you have any unpartitioned space on the drive?
2) Do you have a swap partition that you could use for the transition?
   How big is it?
3) How full is the root FS?
4) Do you have external storage available, i. e. could you attach a
disk to
   a computer at an other location, and NFS mount it to the target
machine?

Clarification of Question by j2geek-ga on 17 May 2002 07:01 PDT
Clarification:

1- if i did, this would not be an issue :)
2- on this particular box, i have a gig of swapspace.  Intriguing
possibilities there, eh?
3- 3%
4- Possibly.  I think i see where you're going with this, but i'm
really looking to resize the partition.

Jake
Answer  

The following answer was rejected by the asker (they reposted the question).
Subject: Re: Remotely Resizing Partitions in Redhat 7.1 or 7.2
Answered By: jeanluis-ga on 17 May 2002 07:39 PDT
Rated:2 out of 5 stars
 
Hello, Assuming this problem isn't already solved. 
    When you say the drive is 3% full, is that less than a gig? If so
I would consider the following:
1) Temporarily re-partition the swap space into 2 new partitions 
   One small swap partition and one large ext3 partition, and format
them.
2) Copy /* to the new ext3 partition. 
3) Re-partition the old ext3 partition (and format it) to the size you
want.
4) Restore the data from step 2. 
5) Re-partition the swap drive to its orignal size. 
 
If the 3% of data is larger than a gig, then you will need to back the
data up in some other way (tape backup, burn a dvd-rom or cd-roms)
 
The basic idea is that you back up all the data, re-partition/format
the drive, and then restore the data.
 
Also Note: That doing something like this may cause other problems,
for example if you re-partition the drive so that the file system is
on multiple partitions you will need to edit your /etc/fstab file to
mount the new partitions.
 
It may be a good idea to (gasp!) re-install from scratch, :( which I
know is a pain in the neck, but it can also be a good excuse to move
upto RedHat 7.3.
 
I hope this works out for you, let us know what happens.  

Clarification of Answer by jeanluis-ga on 17 May 2002 07:53 PDT
Note: It should be possible to backup to the excess swap space
remotely, however backing up to some other media (tape/*-rom) may not
be possible, however it may be possible (very slow, but possible) to
transfer all the data to another computer on the network as a backup.  

Request for Answer Clarification by j2geek-ga on 17 May 2002 17:31 PDT
Okay, this really isn't an answer to the question of how to *resize*
my root partition remotely.  You've described a process implied
_directly_ from philip_lynx's request for clarification (Thanks
philip).  I'm pretty disappointed at your answer.  To avoid giving you
a negative rating, and requesting my money back, I'm giving you an
opportunity to make your answer at all valuable:
 
1- Tell me how to resize an existing root partition so that it takes
less space, if that's possible.  That is the question i was asking,
which i re-emphasized in my question clarification, responding to
Philip's valuable response.
 
2- Tell me in detail how to "(gasp!)" install redhat 7.3 entirely
remotely over telnet or ssh w/o access to a local console.  This would
be a satisfactory remedy to your answer, provided your answer was
accurate and detailed.  

Request for Answer Clarification by j2geek-ga on 17 May 2002 17:33 PDT
By the way, I would still gladly pay for someone who can tell me how
to actually resize my root partition.  Thanks!!!  
Reason this answer was rejected by j2geek-ga:
This answer was simply a recapitulation of philip's request for
clarification.  It did *not* answer the question.  My request for
clarification was ignored.
To the extent that it provided information, the instruction was
lacking in significant detail.  He didn't mention how to turn off the
swap partition, how to edit a partition, etc.   The 2nd star (a
opposed
to 1 star) is because he did mention ot edit /etc/fstab.. the only
unique or useful information in his answer.
j2geek-ga rated this answer:2 out of 5 stars
This was a restatement of philip's request for clarification.  It did
not answer the question.  My request for clarification was ignored. 
To the extent that it provided information, the instruction was
lacking in significant detail.  He didn't mention how to turn off the
swap partition, how to edit a partition, etc.  The 2nd star (a opposed
to 1 star) is because he did mention ot edit /etc/fstab.. the only
unique information in his answer.

Subject: Re: Remotely Resizing Partitions in Redhat 7.1 or 7.2
Answered By: samrolken-ga on 22 May 2002 15:10 PDT
 
j2geek:

Hello. Thanks for your question.

The GNU Parted application may be just what you're looking for. It's a
console-based partition management program. According to the website
of the tool, it is able to resize ext3 partitions, provided the
starting location of the partition remains the same. Since you say
that your root file system takes up the entire drive, this shouldn't
be a problem at all.

Related Resources:

Parted - GNU Project (FSF)
[ http://www.gnu.org/software/parted/ ]

Download From:

[ ftp://ftp.gnu.org/gnu/parted/ ]

Search Strategy: None, I know about parted from personal experience
with Linux.

Clarification of Answer by samrolken-ga on 22 May 2002 16:47 PDT
I realize that having your root partition be the one you're trying to
resize is a problem. Parted is still your answer, but getting it to
work is going to be a little more complicated.

First, you're going to need to get the parted boot diskette from:

ftp://ftp.gnu.org/gnu/parted/bootdisk/partboot.img

Then, you are going to need to mount that diskette image as your root
file system on loopback. No diskettes are involved. More information
on booting from a loopback device can be found here:

http://www.tldp.org/HOWTO/mini/Loopback-Root-FS.html

If that doesn't work, which it should, you could simply recreate the
contents of the parted diskette on your swap partition, and instruct
LILO to boot from there.

If you need more help, you can IM me on yahoo or aim under the id
'samrolken'.

--
Sam Kennedy

Clarification of Answer by samrolken-ga on 22 May 2002 16:56 PDT
One more idea that has to do with loopback devices is that you could
just create a loopback device for each new partition you wish to make.
For example, if you wanted to make a partition named "data", just
create a large file named "data.img" somewhere on the root partition,
run mkfs.ext2 on it, then mount it as a loopback device on /data. Like
that, you have all of the advanteges of having other partitions, but
managing them and creating new ones is as easy as managing files.

--
Sam Kennedy
Comments  
Subject: Re: Remotely Resizing Partitions in Redhat 7.1 or 7.2
From: mun-ga on 16 May 2002 12:07 PDT
 
You'd need to shrink the partition while it's mounted.  As far as I've
been able to figure out this isn't possible.  ext2resize can *grow* a
mounted partition, but not shrink it.  You can try to run parted or
ext2resize on a mounted partition, but the partition will be destroyed
in the process.  ;)  You might have better luck persuing commercial
products.  PQ's partition magic can resize a mounted NTFS or FAT
partition, but I don't think they have a native linux binary that can
do that to an ext3 partition.  If you find a tool that can resize a
mounted ext2, it should be able to resize the ext3 partition you've
got.
Subject: Re: Remotely Resizing Partitions in Redhat 7.1 or 7.2
From: sysadmin-ga on 16 May 2002 16:31 PDT
 
Hey,

I dont know about remotely resizing partions but there is software out
there that will let you create, merge, and resize partitions. You can
probably load the software on the computer and open the program
through telnet. I really dont know because I dont use telnet but you
can always try. The software is called PartitionMagic (who would of
thought) and the link to the site is...
http://www.powerquest.com/partitionmagic/

I hope that helps you out some,
-SysAdmin
Subject: Re: Remotely Resizing Partitions in Redhat 7.1 or 7.2
From: random-ga on 20 May 2002 12:49 PDT
 
What a fun question, it make me think of NASA deep space missions,
trying to upgrade the operating system of some spaceship a million
miles away with no room for failure!

Prerequisites:
1. you know how /etc/fstab, /etc/lilo.conf, fdisk, and lilo work.
2. you have already backed up mission critical data and made plans for
   failover, in the case something catastrophic happens.
3. in the event that you screw up, or I have omitted anything, you
should
   have someone or some way to power cycle the remote machine.
4. I think this is already in the site disclaimer, but I'm not
responsible
   for you frying your system. :)

The answer:
1. make backups of your important data over the net
2. install parted -- http://www.gnu.org/software/parted/ or another
   ext2 resizing tool -- http://linux.msede.com/ext2/
3. kill all unnecessary processes on your remote system and sync
4. swapoff your swap partition (we'll call that former partition
"swap")
5. use fdisk to change "swap"s partition type to linux ext2, then
mke2fs
   "swap" (or some partition thereof, if you have plans for that
space)
6. mount "swap"
7. cp -a enough of your base linux system to "swap" to accept incoming
ssh
   traffic, and of course to contain your newly installed tools.  This
   will probably include files in /bin /sbin /etc /lib /usr /boot /dev
/var.
   You don't need to copy user data, old logs from /var, or /home, as
long
   as your sshd will allow you to log in directly as root.  You will
want to
   make an empty /tmp directory, though, as some programs/daemons need
this.
   If you find you don't have enough space in "swap" try to exclude
things like
   /usr/x11r6, /usr/local, /usr/src/<linux kernel sources>, /opt,
etc...
8. modify the fstab in "swap" to reflect root (/) residing in "swap"
9. add this new root partition and it's "swap"/boot/vmlinuz as a new
entry in
   /etc/lilo.conf called "swapsys" on your current root, and run lilo
10. run lilo -R swapsys to make your system attempt a boot from this
new
    partition on your next boot.
11. sync and unmount or remount -oro "swap"
12. shutdown -r now to reboot your system remotely.  if you configured
the
    swapsys system correctly, the system should come back up using
"swap" as
    it's root
13. you are now free to use parted or another utility to resize the
now
    unmounted root partition, and create new partitions with fdisk
14. manually e2fsck -f your new/resized partitions
15. mount the original root and your new partition(s) off of /mnt
16. modify the original root fstab as appropriate for your new
partition(s)
17. modify your current swapsys root's lilo.conf to to make your
swapsys the
    default boot (cause you know it works now) and make your newly
resized root
    "original"
18. run lilo, then lilo -R original
19. sync and unmount or remount -oro the original root
20. shutdown -r now
21. your system should come back up on the original (but resized) root
22. edit lilo.conf to make the original root your primary
23. run lilo
24. use fdisk to change "swap"s partition type back to swap
25. mkswap "swap", and swapon "swap"
26. do one last pass through fstab to check things and add "swap" back
in
27. reboot a final time, because if you have been careful and gotten
this
    far, you know your system will come back up.
Subject: Re: Remotely Resizing Partitions in Redhat 7.1 or 7.2
From: philip_lynx-ga on 26 Jul 2002 00:42 PDT
 
parted and resize2fs -- I certainly learned something here. Time does
move on, and software does get better (or at least more powerful).

Thanks to all! ;-)
Subject: Re: Remotely Resizing Partitions in Redhat 7.1 or 7.2
From: bcw-ga on 01 Aug 2002 10:34 PDT
 
LVM - Logical Volume Manager

http://www.sistina.com/products_lvm.htm
http://www.sistina.com/lvm_howtos/lvm_howto/

I think this only works if you already had it installed but worth
looking at to see if it will work for you now.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy