0

I read from some link and applied these things

lsblk
xvda 202:0 0 32G 0 disk /   = this disk attahced to new instance from old one
xvdb 202:16 0 80G 0 disk /mnt
xvdc 202:32 0 80G 0 disk
xvdg 202:96 0 32G 0 disk - this volume makes from snapshot of root volume
xvdh 202:112 0 18G 0 disk  - this is use for after all data copied to old instance as /dev/sda1

df -h
/dev/xvda 32G 12G 19G 39% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 7.4G 12K 7.4G 1% /dev
tmpfs 1.5G 380K 1.5G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 7.4G 0 7.4G 0% /run/shm
none 100M 0 100M 0% /run/user

cat /etc/fstab
LABEL=cloudimg-rootfs / ext4 defaults 0 0
#/dev/md0 /mnt auto defaults,nobootwait,noatime 0 2
/dev/ephemeral/mnt /mnt auto defaults,nobootwait,noatime 0 2
/mnt/swap/swapfile swap swap defaults 0 1
/dev/xvdb /mnt auto defaults,nobootwait,comment=cloudconfig 0 2
/dev/xvdb 79G 56M 75G 1% /mnt

started from here :

1 - e2fsck -f /dev/xvdg
e2fsck 1.42.9 (4-Feb-2014)
cloudimg-rootfs: recovering journal
Clearing orphaned inode 24877 (uid=0, gid=0, mode=0100640, size=1050)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong (5211700, counted=5224390).
Fix<y>? yes
Free inodes count wrong (1777738, counted=1777494).
Fix<y>? yes
cloudimg-rootfs: ***** FILE SYSTEM WAS MODIFIED *****
cloudimg-rootfs: 319658/2097152 files (0.4% non-contiguous), 3164218/8388608 blocks

2- resize2fs -M -p /dev/xvdg
resize2fs 1.42.9 (4-Feb-2014)
Resizing the filesystem on /dev/xvdg to 3096164 (4k) blocks.
Begin pass 2 (max = 3886)
Relocating blocks XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 256)
Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 4 (max = 47495)
Updating inode references XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/xvdg is now 3096164 blocks long.

3096164 * 4 / (16 * 1024). = 755 (i will keep 757)

3 - make file system= mkfs -t ext4 /dev/xvdh
4 - 

    dd bs=16M if=/dev/xvdg of=/dev/xvdh count=757
    757+0 records in
    757+0 records out
    12700352512 bytes (13 GB) copied, 599.676 s, 21.2 MB/s

5- e2fsck -f /dev/xvdh
e2fsck 1.42.9 (4-Feb-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
cloudimg-rootfs: 319658/778240 files (0.4% non-contiguous), 3080438/3096164 blocks
6- resize2fs -p /dev/xvdh
resize2fs 1.42.9 (4-Feb-2014)
Resizing the filesystem on /dev/xvdh to 4718592 (4k) blocks.
The filesystem on /dev/xvdh is now 4718592 blocks long.

7- stop the instance
8 - now detached /dev/xvdg and dev/xvdh 
9 - attach /dev/xvdh to old instance

blkid - from new machine..

/dev/xvda: LABEL="cloudimg-rootfs" UUID="aa697099-062b-4b53-976e-f2ac573effd9" TYPE="ext4"
/dev/xvdb: UUID="6dfa91c5-14de-4c59-983e-e851e7dc6ead" SEC_TYPE="ext2" TYPE="ext3"
/dev/xvdc: UUID="6dfa91c5-14de-4c59-983e-e851e7dc6ead" SEC_TYPE="ext2" TYPE="ext3"
/dev/xvdg: LABEL="cloudimg-rootfs" UUID="aa697099-062b-4b53-976e-f2ac573effd9" TYPE="ext4"
/dev/xvdh: LABEL="cloudimg-rootfs" UUID="aa697099-062b-4b53-976e-f2ac573effd9" TYPE="ext4"

but i attached with old instance as dev/sda1 but its showing blank screen log and after make ami not showing any log and after start machine shows status check failed. Please any one suggest how to solve this problem..

4
  • What type of images are you using - hvm or pv?
    – ALex_hha
    May 25, 2016 at 10:54
  • hvm image i am using..
    – Obivan
    May 25, 2016 at 10:56
  • 1
    I notice you post the question to the origin site about the step. The tricky part is, a ROOT partition need specific header, you can't simply copy this value by using dd. Hence, there is suggestion from commenter: you should better create an instance instead of creating the volume yourself. Otherwise you have to format the volume, create partitions, mark the root flag etc etc. Just create an instance with the same operating system, detach the volume from it and use that volume. Then, step 9 can be omitted.
    – mootmoot
    May 25, 2016 at 11:13
  • problem was solved there ar some files under proc is only readable these are character files like /proc/cmdline.. when i was read this doc help me on this .. docs.aws.amazon.com/AWSEC2/latest/UserGuide/…
    – Obivan
    May 26, 2016 at 11:24

0

You must log in to answer this question.

Browse other questions tagged .