Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Resizing partitions with Live CD without loosing data
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
neo_phani
n00b
n00b


Joined: 01 Sep 2004
Posts: 67

PostPosted: Thu Aug 04, 2005 8:33 pm    Post subject: Resizing partitions with Live CD without loosing data Reply with quote

This is my existing disk lay out of my gentoo system on a Maxtor 40 GB hard drive

Disk /dev/hda: 41.1 GB, 41110142976 bytes
255 heads, 63 sectors/track, 4998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 5 40131 83 Linux
/dev/hda2 6 68 506047+ 82 Linux swap
/dev/hda3 69 4998 39600225 83 Linux


I am using Acronis and created a image so that i can recreate the same system by restoring the image. Now i bought a Segate 40 GB HDD and am trying to restore the image and guess what due to the differences in the way that these two manufactures count bytes and hence forth gigs the image from the MAxtor wont fit in the seagate.

and in hda3 i have lot of free space. Is there any way i could trim that free space by booting through live CD like knopixx and then recreate the image? or any other ways to accomplish this trimming of /dev/hda3 without loosing data ...is it possible ?

or any other ways of porting the entire sytem to a new hard drive ....i have done googling but nothing appealing ....


Thanks
Back to top
View user's profile Send private message
neo_phani
n00b
n00b


Joined: 01 Sep 2004
Posts: 67

PostPosted: Thu Aug 04, 2005 9:03 pm    Post subject: Reply with quote

sorry dont hurt yourself....i found it

http://lists.tummy.com/pipermail/krudusers/2002-November/000350.html
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4734
Location: Angra do Heroísmo (PT)

PostPosted: Thu Aug 04, 2005 11:48 pm    Post subject: Reply with quote

Hi.

You can always copy the contents from the old disk to the new disk with
Code:
# cp -a /mnt/old_disk /mnt/new_disk

This should be done with a live-cd and mounting the entire tree for the old and new disk.
If you can't connect both disks to the same system, you can compress the original disk in a tar.bz2 archive, just like the Gentoo base system and portage, and decompress it on the new one.
_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
neo_phani
n00b
n00b


Joined: 01 Sep 2004
Posts: 67

PostPosted: Fri Aug 05, 2005 1:02 am    Post subject: Reply with quote

Thanks for your response jmbsvicetto.

ok i attached them to same machine

under /mnt it shows up as

old disk says

hda1 hda3 (hda2 is swap)

new one says

hdb


i boot through the live cd and do a mount -a (automount as hda and hdb are in /etc/fstab

then cp -a /mnt/hda /mnt/hdb

that didnt work out....the new hard drive has nothing in it. What am i not following.
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4734
Location: Angra do Heroísmo (PT)

PostPosted: Fri Aug 05, 2005 2:41 am    Post subject: Reply with quote

You didn't understood my suggestion.

If your old disk has the following structure
Code:
/dev/hda1 /boot ext2 128MB
/dev/hda2 sw swap 512MB
/dev/hda3 /home reiserfs 10GB
/dev/hda4 / ext3 29GB

and your new disk will have the following structure
Code:
/dev/hdb1 /boot ext2 128MB
/dev/hdb2 /home reiserfs 10GB
/dev/hdb5 sw swap 512MB
/dev/hdb6 / reiserfs 10GB
/dev/hdb7 /usr jfs 14GB
/dev/hdb8 /var xfs 5GB

You have to do the following to mount the disks under /mnt/old_disk and /mnt/new_disk.
Code:
# mkdir /mnt/old_disk
# mkdir /mnt/new_disk
# mount -t ext3 /dev/hda4 /mnt/old_disk
# mount -t ext2 /dev/hda1 /mnt/old_disk/boot
# mount -t reiserfs /dev/hda3 /mnt/old_disk/home
# mount -t reiserfs /dev/hdb6 /mnt/new_disk
# mount -t ext2 /dev/hdb1 /mnt/new_disk/boot
# mount -t reiserfs /dev/hdb2 /mnt/new_disk/home
# mount -t jfs /dev/hdb7 /mnt/new_disk/usr
# mount -t xfs /dev/hdb8 /mnt/new_disk/var

You can then copy your info from the old disk to the new disk with
Code:
# cp -a /mnt/old_disk/* /mnt/new_disk

Don't forget to update your /etc/fstab and reinstall GRUB after completing this step to be able to boot from your new disk.
_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4734
Location: Angra do Heroísmo (PT)

PostPosted: Fri Aug 05, 2005 2:44 am    Post subject: Reply with quote

Oh and before you go ahead, remember that you must first partition your new disk and to make the filesystems. Re-read the Gentoo Handbook if you have any doubts on this.
_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
neo_phani
n00b
n00b


Joined: 01 Sep 2004
Posts: 67

PostPosted: Fri Aug 05, 2005 5:14 pm    Post subject: Reply with quote

Thank you very much.Will try this....
Back to top
View user's profile Send private message
jfave
Tux's lil' helper
Tux's lil' helper


Joined: 28 Jul 2004
Posts: 96
Location: Jacksonville, FL

PostPosted: Sat Aug 06, 2005 4:21 pm    Post subject: Reply with quote

neo_phani:

jmbsvicetto suggestion will work. I do this all the time with backups and cloning machines constantly. I have several dns machines I admin that have the same hardware specs.

You can even get fancy and cron the backup to a remote machine.... that way when you trash your system you can restore it quickly to its last backup state. Check out this post on stage-4 installs....... https://forums.gentoo.org/viewtopic-t-146750-highlight-stage4.html
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum