Amazon EC2 Volume Snapshot Creation Recovery
Login into the Linux instance and perform the command
df -h
lsblk
fdisk -l
file -s /dev/xvdf
to verify the allocated sapce fdisk -l
[root@ip-172-31-12-159 ec2-user]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/xvda: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
# Start End Size Type Name
1 4096 16777182 8G Linux filesyste Linux
128 2048 4095 1M BIOS boot parti BIOS Boot Partition
Disk /dev/xvdf: 9663 MB, 9663676416 bytes, 18874368 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
to create the file system .ext4 in new volume
[root@ip-172-31-12-159 ec2-user]# mkfs.ext4 dev/xvdf
mke2fs 1.42.12 (29-Aug-2014)
The file dev/xvdf does not exist and no size was specified.
[root@ip-172-31-12-159 ec2-user]# mkfs.ext4 /dev/xvdf
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 2359296 4k blocks and 589824 inodes
Filesystem UUID: 7c1f2d68-b651-41f5-a977-637ce1c29da2
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
create directory
mkdir tamil
mount
[root@ip-172-31-12-159 /]# mount /dev/xvdf /tamil/
[root@ip-172-31-12-159 /]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 488M 60K 488M 1% /dev
tmpfs 497M 0 497M 0% /dev/shm
/dev/xvda1 7.8G 1.1G 6.7G 14% /
/dev/xvdf 8.8G 21M 8.3G 1% /tamil
[root@ip-172-31-12-159 /]# cd /tamil/
[root@ip-172-31-12-159 tamil]# mkdir test1 test2 test3
[root@ip-172-31-12-159 tamil]# ls
lost+found test1 test2 test3
[root@ip-172-31-12-159 tamil]# cd test1
[root@ip-172-31-12-159 test1]# vi tamil
[root@ip-172-31-12-159 test1]# cat tamil
hello tamil
cd /
unmount the volume form the instance
[root@ip-172-31-12-159 /]# umount /tamil
[root@ip-172-31-12-159 /]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 488M 60K 488M 1% /dev
tmpfs 497M 0 497M 0% /dev/shm
/dev/xvda1 7.8G 1.1G 6.7G 14% /
detatch the volume form aws console and take the snapshot of the volume
once snapshot is created and delete the volume which you detached
by using the snapshot create the volume and attach to the instance
check in the instance
[root@ip-172-31-12-159 ec2-user]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/xvda: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
# Start End Size Type Name
1 4096 16777182 8G Linux filesyste Linux
128 2048 4095 1M BIOS boot parti BIOS Boot Partition
Disk /dev/xvdf: 9663 MB, 9663676416 bytes, 18874368 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@ip-172-31-12-159 ec2-user]# file -s /dev/xvdf
/dev/xvdf: Linux rev 1.0 ext4 filesystem data, UUID=7c1f2d68-b651-41f5-a977-637ce1c29da2 (extents) (large files) (huge files)
[root@ip-172-31-12-159 ec2-user]#
don't create the filesystem again, if create the fs it will destory ur data
[root@ip-172-31-12-159 ec2-user]# cd /
[root@ip-172-31-12-159 /]# mount /dev/xvdf /tamil
[root@ip-172-31-12-159 /]# df-h
bash: df-h: command not found
[root@ip-172-31-12-159 /]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 488M 60K 488M 1% /dev
tmpfs 497M 0 497M 0% /dev/shm
/dev/xvda1 7.8G 1.1G 6.7G 14% /
/dev/xvdf 8.8G 21M 8.3G 1% /tamil
[root@ip-172-31-12-159 /]# cd /tamil
[root@ip-172-31-12-159 tamil]# ls
lost+found test1 test2 test3
[root@ip-172-31-12-159 tamil]# ls -ltr
total 28
drwx------ 2 root root 16384 Dec 12 14:48 lost+found
drwxr-xr-x 2 root root 4096 Dec 12 14:55 test3
drwxr-xr-x 2 root root 4096 Dec 12 14:55 test2
drwxr-xr-x 2 root root 4096 Dec 12 14:56 test1
[root@ip-172-31-12-159 tamil]# cd test1
[root@ip-172-31-12-159 test1]# ls-ltr
bash: ls-ltr: command not found
[root@ip-172-31-12-159 test1]# ls -ltr
total 4
-rw-r--r-- 1 root root 13 Dec 12 14:56 tamil
[root@ip-172-31-12-159 test1]# cat tamil
hello tamil
[root@ip-172-31-12-159 test1]#
Login into the Linux instance and perform the command
df -h
lsblk
fdisk -l
file -s /dev/xvdf
to verify the allocated sapce fdisk -l
[root@ip-172-31-12-159 ec2-user]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/xvda: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
# Start End Size Type Name
1 4096 16777182 8G Linux filesyste Linux
128 2048 4095 1M BIOS boot parti BIOS Boot Partition
Disk /dev/xvdf: 9663 MB, 9663676416 bytes, 18874368 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
to create the file system .ext4 in new volume
[root@ip-172-31-12-159 ec2-user]# mkfs.ext4 dev/xvdf
mke2fs 1.42.12 (29-Aug-2014)
The file dev/xvdf does not exist and no size was specified.
[root@ip-172-31-12-159 ec2-user]# mkfs.ext4 /dev/xvdf
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 2359296 4k blocks and 589824 inodes
Filesystem UUID: 7c1f2d68-b651-41f5-a977-637ce1c29da2
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
create directory
mkdir tamil
mount
[root@ip-172-31-12-159 /]# mount /dev/xvdf /tamil/
[root@ip-172-31-12-159 /]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 488M 60K 488M 1% /dev
tmpfs 497M 0 497M 0% /dev/shm
/dev/xvda1 7.8G 1.1G 6.7G 14% /
/dev/xvdf 8.8G 21M 8.3G 1% /tamil
[root@ip-172-31-12-159 /]# cd /tamil/
[root@ip-172-31-12-159 tamil]# mkdir test1 test2 test3
[root@ip-172-31-12-159 tamil]# ls
lost+found test1 test2 test3
[root@ip-172-31-12-159 tamil]# cd test1
[root@ip-172-31-12-159 test1]# vi tamil
[root@ip-172-31-12-159 test1]# cat tamil
hello tamil
cd /
unmount the volume form the instance
[root@ip-172-31-12-159 /]# umount /tamil
[root@ip-172-31-12-159 /]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 488M 60K 488M 1% /dev
tmpfs 497M 0 497M 0% /dev/shm
/dev/xvda1 7.8G 1.1G 6.7G 14% /
detatch the volume form aws console and take the snapshot of the volume
once snapshot is created and delete the volume which you detached
by using the snapshot create the volume and attach to the instance
check in the instance
[root@ip-172-31-12-159 ec2-user]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/xvda: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
# Start End Size Type Name
1 4096 16777182 8G Linux filesyste Linux
128 2048 4095 1M BIOS boot parti BIOS Boot Partition
Disk /dev/xvdf: 9663 MB, 9663676416 bytes, 18874368 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@ip-172-31-12-159 ec2-user]# file -s /dev/xvdf
/dev/xvdf: Linux rev 1.0 ext4 filesystem data, UUID=7c1f2d68-b651-41f5-a977-637ce1c29da2 (extents) (large files) (huge files)
[root@ip-172-31-12-159 ec2-user]#
don't create the filesystem again, if create the fs it will destory ur data
[root@ip-172-31-12-159 ec2-user]# cd /
[root@ip-172-31-12-159 /]# mount /dev/xvdf /tamil
[root@ip-172-31-12-159 /]# df-h
bash: df-h: command not found
[root@ip-172-31-12-159 /]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 488M 60K 488M 1% /dev
tmpfs 497M 0 497M 0% /dev/shm
/dev/xvda1 7.8G 1.1G 6.7G 14% /
/dev/xvdf 8.8G 21M 8.3G 1% /tamil
[root@ip-172-31-12-159 /]# cd /tamil
[root@ip-172-31-12-159 tamil]# ls
lost+found test1 test2 test3
[root@ip-172-31-12-159 tamil]# ls -ltr
total 28
drwx------ 2 root root 16384 Dec 12 14:48 lost+found
drwxr-xr-x 2 root root 4096 Dec 12 14:55 test3
drwxr-xr-x 2 root root 4096 Dec 12 14:55 test2
drwxr-xr-x 2 root root 4096 Dec 12 14:56 test1
[root@ip-172-31-12-159 tamil]# cd test1
[root@ip-172-31-12-159 test1]# ls-ltr
bash: ls-ltr: command not found
[root@ip-172-31-12-159 test1]# ls -ltr
total 4
-rw-r--r-- 1 root root 13 Dec 12 14:56 tamil
[root@ip-172-31-12-159 test1]# cat tamil
hello tamil
[root@ip-172-31-12-159 test1]#
Comments
Post a Comment