Skip to main content

Amazon EC2 Volume Snapshot Creation and Recovery

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]#





                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Comments

Popular posts from this blog

AWS S3 Simple Storage Service

                             Amazon  S3  (Simple Storage Service) Amazon Simple Storage Service is storage for the Internet. It is designed to make web-scale computing easier for developers. Amazon  S3  has a simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web. What Is Amazon S3? Amazon Simple Storage Service is storage for the Internet. It is designed to make web-scale computing easier for developers. Amazon S3 has a simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, fast, inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites. The service aims to maximize benefits of scale and to pass those benefit...

AWS Route 53 & Routing Policy

Amazon Route 53 You can use Amazon Route 53 to register new domains, transfer existing domains, route traffic for your domains to your AWS and external resources, and monitor the health of your resources. Amazon  Route 53  ( Route 53 ) is a scalable and highly available Domain Name System (DNS). It is part of Amazon.com's cloud computing platform, Amazon Web Services (AWS). The name is a reference to TCP or UDP port  53 , where DNS server requests are addressed. ...  Route 53's  servers are distributed throughout the world. DNS management If you already have a domain name, such as example.com, Route 53 can tell the Domain Name System (DNS) where on the Internet to find web servers, mail servers, and other resources for your domain. Learn More Traffic management Route 53 traffic flow provides a visual tool that you can use to create and update sophisticated routing policies to route end users to multiple endpoints for your application. Le...

Amazon EBS Elastic Block Store

     Amazon Elastic Block Store Amazon  Elastic Block Store  (Amazon  EBS ) provides persistent block storage volumes for use with Amazon EC2 instances in the  AWS  Cloud. Each Amazon  EBS volume is automatically replicated within its Availability Zone to protect you from component failure, offering high availability and durability. Amazon Elastic Block Store (Amazon EBS) provides persistent block storage volumes for use with  Amazon EC2  instances in the AWS Cloud. Each Amazon EBS volume is automatically replicated within its Availability Zone to protect you from component failure, offering high availability and durability. Amazon EBS volumes offer the consistent and low-latency performance needed to run your workloads. With Amazon EBS, you can scale your usage up or down within minutes – all while paying a low price for only what you provision. Amazon EBS is designed for application workloads that benefit from fine tu...