FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 12-08-2010, 02:30 PM
Jerry Geis
 
Default copy old CF image to new CF device

I am using an 8G CF card. (I was using dd to duplicate the card with
different size cards I was advised not to).

So I wrote the script below which basically:
1) runs fdisk to setup the device
2) makes the ext3 file system and the swap
3) mounts my old image "/" filesystem and the new partition
4) tar and untar the directories
5) run grub on it
6) set label for "/"

After I run all the above I get:

EXT3-fs error ext3_find_entry reading directory #129586 offset 0

then a couple lines later it remounts the root file system read only.

What have I missed in successfully make the CF card based on the old image?

Jerry
---------

DEVICE=/dev/sde
PARTITION_1=/dev/sde1
PARTITION_2=/dev/sde2

fdisk $DEVICE << EOF
o
n
p
1

+7000M
n
p
2


t
2
82
a
1
w
EOF

echo ""
fdisk -l $DEVICE

echo ""
mke2fs -j $PARTITION_1
mkswap $PARTITION_2

# mount the first partition in the image file
mount -t ext3 -o loop,offset=32256 ebox4300.centos.5.5.cf.img /mnt/from_image
mount -t ext3 $PARTITION_1 /mnt/to_image

PUSH_PWD=`pwd`

# Directories to copy
cd /mnt/from_image
for DIRECTORY in bin boot dev etc home install lib misc net opt root sbin selinux srv tftpboot tmp usr var
do
tar -cf - $DIRECTORY | (cd /mnt/to_image; tar -xpvf - )
done

# Skip these directories above and just make them for mounting
mkdir /mnt/to_image/proc
mkdir /mnt/to_image/sys

cd $PUSH_PWD

umount /mnt/from_image
umount /mnt/to_image

grub << EOF
device (hd0) $DEVICE
root (hd0,0)
setup (hd0)
quit
EOF

e2label $PARTITION_1 "/"
mkswap -L "SWAP-hda2" $PARTITION_2




_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 10:50 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org