LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-07-2009, 11:27 PM   #1
k_oudom
Member
 
Registered: Aug 2009
Posts: 293

Rep: Reputation: 30
Move OS to Another Hard Disk


While the data is increasing, my hard disk is going to run out of space. I want to move OS to another bigger hard disk and extend the space without having to brick my OS. Is there any solution?
 
Old 10-07-2009, 11:36 PM   #2
wfh
Member
 
Registered: Sep 2009
Location: Northern California
Distribution: Ubuntu Debian CentOS RHEL Suse
Posts: 164

Rep: Reputation: 44
Quote:
Originally Posted by k_oudom View Post
While the data is increasing, my hard disk is going to run out of space. I want to move OS to another bigger hard disk and extend the space without having to brick my OS. Is there any solution?
Having done this a number of times, I can tell you that much depends on how you partitioned your disk at installation time; I'm referring to your original install. It's simpler if you broke things out into separate partitions.

Did you make partitions for home, boot, var, etc?

Can you post the result of this:

# df -h

Also, what OS? What kind of disk is it running on (i.e. SCSI, SATA, IDE, etc.) What are you running...a big web server, for instance? Do you have masses of personal data? What's important to preserve *BEFORE* you potentially brick your system : )
 
Old 10-07-2009, 11:40 PM   #3
k_oudom
Member
 
Registered: Aug 2009
Posts: 293

Original Poster
Rep: Reputation: 30
I only created 2 partition for CentOS 5.3. Swap and other one for all such as /, /home, /var, /tmp, ....
 
Old 10-08-2009, 12:17 AM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Putting the OS on a bigger disk does not make sense; you should put the data on a bigger disk.
Not sure what you're all running. Assuming that this is a webserver with a MySQL database:
  1. make backups of the data that is going to be moved
  2. install new HD
  3. partition and format new HD; use a partition for webpages and a partition for mysql (as an example).
  4. modify /etc/fstab and add the new partitions so they will be mounted at boot time
  5. mount the new partitions manually
  1. stop mysql
  2. copy mysql data to the new partition allocated for mysql (make sure you preserve the permissions and ownerships of the files (e.g. cp -p -r)
  3. reconfigure the mysql datadirectory in the startup script
  4. restart mysql
  1. copy all the websites to the partition allocated to websites again making sure to preserve the permissions and ownerships
  2. not sure if there's an easy way, but you need to modify all documentroots
  3. restart apache

After everything is done, reboot. This will make sure that the new partitions will be mounted during a reboot.
Once you're happy that everything works, you can delete the originals.

Notes:
1)
I assume that your webpages are somewhere in /var. If they are in /home, the procedure for apache will be slightly different.
2)
I've done this on Slackware; not sure how it all works under Centos and where configs are stored. Therefore this is only a general description.

Last edited by Wim Sturkenboom; 10-08-2009 at 12:20 AM.
 
Old 10-08-2009, 02:48 AM   #5
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by wfh View Post
It's simpler if you broke things out into separate partitions.

Did you make partitions for home, boot, var, etc?
No, as a matter of fact, this is a stupid practice. The number of disk-full failure modes is equal to the number of partitions. The fewer partitions, the better.

For practical reasons, about three partitions is best:

1. The system root (/), containing /var, /usr, /etc, /tmp, etc. etc. -- all the system directories.

2. Swap, twice the size of system RAM

3. Everything else.

Reasonable arguments can be made for a few more partitions, but creating partitions for each of /boot, /var, /usr, /opt, /tmp and the usual cast of characters, as is so often suggested here, is unremittingly stupid and leads to unnecessary failures as one partition inevitably fills up and kills the system while there is plenty of free space elsewhere.
 
Old 10-08-2009, 03:58 AM   #6
k_oudom
Member
 
Registered: Aug 2009
Posts: 293

Original Poster
Rep: Reputation: 30
Did you experience resize partition in Windows XP. That's what I want.
 
Old 10-08-2009, 04:37 AM   #7
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
First it's centos, now WinXP is added to the mix. Do you mind to elaborate? ANd maybe the output of df-h as requested by wfh might help us to advise.
 
Old 10-08-2009, 04:48 AM   #8
k_oudom
Member
 
Registered: Aug 2009
Posts: 293

Original Poster
Rep: Reputation: 30
Can we clone Linux OS to another Hard Disk?
 
Old 10-08-2009, 04:57 AM   #9
Rincewind456
LQ Newbie
 
Registered: Feb 2006
Location: Rimwards
Distribution: Ubuntu
Posts: 8

Rep: Reputation: 0
Quote:
Originally Posted by k_oudom View Post
Can we clone Linux OS to another Hard Disk?
Yes use the dd command. Done it loads of times with Linux and winblows partitions.
 
Old 10-08-2009, 05:01 AM   #10
k_oudom
Member
 
Registered: Aug 2009
Posts: 293

Original Poster
Rep: Reputation: 30
Clone OS without shutting down? No way!
 
Old 10-08-2009, 07:05 AM   #11
Rincewind456
LQ Newbie
 
Registered: Feb 2006
Location: Rimwards
Distribution: Ubuntu
Posts: 8

Rep: Reputation: 0
Quote:
Originally Posted by k_oudom View Post
Clone OS without shutting down? No way!
No you can't. Who said you could?
 
Old 10-08-2009, 11:04 PM   #12
k_oudom
Member
 
Registered: Aug 2009
Posts: 293

Original Poster
Rep: Reputation: 30
Type "dd" in command line?
 
Old 10-08-2009, 11:27 PM   #13
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
yes, and read man dd
 
Old 10-08-2009, 11:36 PM   #14
k_oudom
Member
 
Registered: Aug 2009
Posts: 293

Original Poster
Rep: Reputation: 30
I'm not yet turning on the OS but what I want to make sure is:
This can be use to resize of the current-use-partition just like using Partition Magic in Microsoft Windows XP, right?
 
Old 10-09-2009, 04:41 AM   #15
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by k_oudom View Post
I'm not yet turning on the OS but what I want to make sure is:
This can be use to resize of the current-use-partition just like using Partition Magic in Microsoft Windows XP, right?
I probably missed something but what is the this in the above sentence?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy of IBM Server hard disk data to Another USB External Hard disk mazharcdn Linux - Server 2 09-02-2009 12:41 AM
Hard Disk Failure: How do I move data to a new hard disk drive? spyros Linux - Software 2 10-31-2008 03:01 PM
60GB laptop hard disk & 200GB external USB hard disk linux compatibility powah Linux - Hardware 0 03-07-2006 10:55 AM
move mbr to different hard disk taiwf Linux - Hardware 4 08-11-2005 09:58 PM
Move hard disk with OS te_conway Linux - General 1 03-12-2002 09:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration