LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices



Reply
 
Search this Thread
Old 05-26-2004, 12:44 PM   #1
vdemuth
Member
 
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware 14 (Server),Suse 13.1 (Desktop),, Mepis on the wifes lappy
Posts: 770

Rep: Reputation: 94
Move an existing partition to a new hard drive?


Hello everyone,
My current /usr partition is begining to fill up, and I want to move it to my second hard drive. What is the easiest non-destuctive way to do this. I have discovered that I can't have 2 partitions both named /usr, and so am getting out of my depth here.

TIA
 
Old 05-28-2004, 09:46 AM   #2
aikempshall
Member
 
Registered: Nov 2003
Location: Bristol, Britain
Distribution: Slackware
Posts: 395

Rep: Reputation: 41
Well. I would -

1.
create a new partition;

2.
do a cp -a from the existing /usr to the new partition;

3.
amend my /etc/fstab to point to the new partition;

4.
if you've labeled the partitions may cause a problem all my partitions are unlabeled so I use /etc/fstab to ecxplicitly point to the appropriate directories;

5.
reboot.
 
Old 05-28-2004, 11:56 AM   #3
Goala
Member
 
Registered: May 2004
Location: Merida (Spain)
Distribution: Debian
Posts: 89

Rep: Reputation: 15
hi vdemuth

I would do:

1) Use cfdisk to create the partition in the new disk (call it emmmmm.... /dev/hd??)
2) mkfs.ext3 /dev/hd?? to create a ext3 file system in the new partition (you can use ext2, reiserfs... of course).
3) mkdir a new directory in your system... call it emmm... /usr_new
5) mount -t ext3 /dev/hd?? /usr_new
4) cd /usr && tar cvf /usr_new/usr_new.tar * (with tar you keep the symbolic links)
5) cd /usr_new && tar xvf usr_new.tar && rm usr_new.tar
6) vi /etc/fstab and change the line with /usr bla,bla,bla with /usr /dev/hd??.
7) reboot


Bye.
 
Old 05-28-2004, 12:15 PM   #4
vdemuth
Member
 
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware 14 (Server),Suse 13.1 (Desktop),, Mepis on the wifes lappy
Posts: 770

Original Poster
Rep: Reputation: 94
OK, aikempshall I intend to give that a go. I take it then that if I wanted to do the same with say my /home partition, I just follow the same procedure.(using the correct names of course).
Could I then, ask you a second question? If I were to carry this out succesfully, then resize my now defunct partitions, and then transfer back again. Am I able then to keep my partitions as they are?
And could ypou please explain about the reference you made to labeling.
Thanks.

Oh, thanks to too goala for his suggestion.
 
Old 05-29-2004, 04:42 AM   #5
aikempshall
Member
 
Registered: Nov 2003
Location: Bristol, Britain
Distribution: Slackware
Posts: 395

Rep: Reputation: 41
The steps outlined by Goala is the standard textbook approach. Where I've departed from this approach is to use "cp -a" instead of tar.

Yes to your second question. What you appear to intend to do is to use the new partition as effectively a temporary back up device whilst insreasing the size of the existing partition.

In cfdisk you can assign a label to a partition and use that label in fstab to mount the partition. Some time ago I spent a little time trying to work out why my system wouldn't boot cleanly after moving partitions around following my ditching of redhat and fedora. I removed the label via cfdisk and haven't looked back since. Labeling of partitions probally makes life a little easier in a large installation where life is organised.

Regards
 
Old 06-02-2004, 08:18 AM   #6
vdemuth
Member
 
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware 14 (Server),Suse 13.1 (Desktop),, Mepis on the wifes lappy
Posts: 770

Original Poster
Rep: Reputation: 94
Thanks to everyone who helped me out with this problem. After following the suggestions outlined, I have successfully managed the task, and learned a bit more at the same time.
 
Old 06-03-2004, 04:16 AM   #7
Goala
Member
 
Registered: May 2004
Location: Merida (Spain)
Distribution: Debian
Posts: 89

Rep: Reputation: 15
that's the idea :

solve a problem and learn a lot!

congratulations!
 
Old 06-03-2004, 06:12 AM   #8
vdemuth
Member
 
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware 14 (Server),Suse 13.1 (Desktop),, Mepis on the wifes lappy
Posts: 770

Original Poster
Rep: Reputation: 94
Thanks goala, but here's another quick question for you. Everything appears OK. CFDISK shows my new partitions at the right sizes, as does qtparted, fdisk,lsparts and diskdrake, but the command df shows the partition /dev/hda1 as only being 738Mb when it's 3.9Gb (as shown by cfdisk).
Any idea what might have caused this?
 
Old 06-03-2004, 10:28 AM   #9
Goala
Member
 
Registered: May 2004
Location: Merida (Spain)
Distribution: Debian
Posts: 89

Rep: Reputation: 15
have yoy tried?

df -k (show the sizes in kbytes)
df --block-size=1M (Sizes in megabytes)
 
Old 06-04-2004, 03:29 AM   #10
vdemuth
Member
 
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware 14 (Server),Suse 13.1 (Desktop),, Mepis on the wifes lappy
Posts: 770

Original Poster
Rep: Reputation: 94
Solved,
Turns out that the resizing script in Mandy is flawed, and it doesn't run the resize_reiserfs command. Ran that command, gave it the partition size, even though the doc's say it doesn't need it to grow, and df now reads space correctly.
All of the above incidentally done under pclinux2k4 live CD, as it's the closest next distro to mandy, and therefore very familiar to use.
 
  


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
How to add a hard drive existing Linux system a1ntsk33r3d Linux - Hardware 5 06-28-2005 03:20 PM
How to install a new hard drive on to existing system ksgill Linux - Newbie 3 02-07-2005 01:17 AM
Hard drive dying. Need to move Linux partition over. Fear58 Linux - General 3 01-29-2005 06:14 PM
Partitioning existing hard drive NickC Linux - Hardware 4 12-09-2003 05:44 AM
Add a new hard drive to existing RH 7.2 guanyu Linux - Software 1 02-27-2002 11:17 PM


All times are GMT -5. The time now is 07:05 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration