Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing system disk without reinstal? 6

Status
Not open for further replies.

piti

Technical User
Apr 12, 2001
627
SK
i'm slowly running out of disk space
i was thinking about bying a new disk
is it possible to somehow "copy" the linux installation to the new disk without the need of reinstalling
or what is the best way to switch the disks?
 
The best way is just to install your new disk, format and
partition it., and then mount it: mount /dev/hdd /mnt/new

Then say that you want to transfer the contents/structure of /var to the new disk..good choice if you have a busy
server class box with a single drive(bad idea).

cp -a /var/ /mnt/new
rm -rf /usr

ln -s /mnt/new /usr/

Then add your new mount scheme to /etc/fstab.

That is one way.

With the new journaling filesystems and lvm there are other options.
for reiserfs is a source and the
lvm howto is an excellent source for lvm and software raid.

Good Luck.
 
OOps!
Big mistake!!!!!

should be
cp -a /var /mnt/new
rm -rf /var !!!!!

ln -s /mnt/new /var

I must have been asleep.
 
Hi,
Hmmmmm .... yes that particular typo would not have had quite the desired result !!

If you're adding hard drives you're obviously going to take the system down so, once you've copied files/directories onto a new physical partition you can just edit /etc/fstab to mount that partition at the normal mount-point. For example, if /var was previously within the '/' partition you can add a line like the following saying its now on another physical partition :

/dev/hdb1   /var   ext2 defaults   1 2
(/dev/hdb1 is just an example)

This is a bit simpler than using links. Obvious candidates for their own partition are /var, /usr, /home . Please note, however, that you cannot put any of : /bin, /dev, /etc, /lib, or /sbin in separate partitions because they must all be in the filesystem at boot time.

Regards
 
isn't there a better way using dd? dd would be the way to go if you want to transfer the whole disk image.

If you just want to add a disk then you can temporarily mount onto /mnt/temp, copy the old mount to the /mnt/temp. Once the copy is verified, you can edit /etc/fstab so that the new file system takes the place of the old mount. The old mount can now be used for something else.

This a better solution than linking the new mount to the old.
 
thanx guys for your posts
your way is adding another disk to the system, am i right?

i was actually searching for a disk (partition) image transfer, with the possibility to transfer the original (small) partition to a bigger one on the new disk and then somehow changing config files that represent the disk status (i found only /etc/fstab with such info) to reflect the new situation

could it be done with the "dd" way as bluedevils posted?
 
Sure dd is more efficient, as is copying a backup of the
entire directory structure to the new disk and remounting..but it takes a while-> this is 5 minutes work.

Otherwise your suggestions are much better.
 
I've never done a disk image copy, but the basic would be dd if=/dev/hdc of=/dev/hdd

Oooh another reminder if you don't use dd and you try the /mnt/temp thing, you might want to use tar instead of copy. It preserves ownership and permissions.

man pages are your friends. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top