Sunday, October 26, 2008

upgrade a linux hard disk

reason:
my 2GB SD card very soon run out of spaces that i need a bigger SD card
goal:
transfer my 2GB card system to a 16GB card
references:
http://encodable.com/tech/blog/2006/10/30/Ubuntu_Linux_Hard_Drive_Upgrade
http://tlug.dnho.net/?q=node/91
http://www.togaware.com/linux/survivor/Upgrade_Hard.html
my steps (assume root or sudo...)
0. # check existing partitions
sfdisk -l /dev/sdg
sfdisk -d /dev/sdg > sdg.out
# the next line wouldn't work because i have different size of card
sfdisk /dev/sde < sde.out # need to edit sdg.out to get sde.out
1. # partitionng the new disk
fdisk /dev/sde
# some extra stuff might be useful:
mount -t ext3 /dev/sdg1 oldd/
mount -t ext3 /dev/sde1 newd/
2. # format new partitions
mkfs.ext3 /dev/sde5
mkswap /dev/sde6
3. # (remote) copy linux directories from old disk to new disk
rsync -av --delete --exclude oldd/home/ oldd/ newd/
rsync -av oldd/home/ newd/home/
4. some directories not copied..
5. so umount then run
fsck.ext3 -p /dev/sde1
6. still not work...
mkfs.ext3 -c /dev/sde1
to be continue...

at last:
7. mount disk
8. find uuid of partitions in /dev/disk/by-uuid/
9. use new UUIDs in /etc/fstab and /boot/grub/menu.lst
10. grub
> find /boot/grub/stage1 i.e. see help

grub> setup (hd0) (hd0,0)

...which installs grub into the MBR of hd0 (hda) using the boot files that were already in /boot on hd0,0 (hda1).

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home