Linux Disk EBS

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 14

https://www.youtube.com/watch?

v=3rex_UZPTF4
fdisk /dev/xvdf

lsblk

mkdir /swetha

lsblk &ls -la

sudo mkfs.ext4 /dev/xvdf1

lsblk

sudo mount /dev/xvdf1 /swetha/

sudo vi /etc/fstab

cd /swetha

touch a1 a2 a3

login as: ec2-user

Authenticating with public key "imported-openssh-key"

[ec2-user@ip-172-31-82-165 ~]$ sudo su

[root@ip-172-31-82-165 ec2-user]#

[root@ip-172-31-82-165 ec2-user]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

xvdf 202:80 0 100G 0 disk

[root@ip-172-31-82-165 ec2-user]# fdisk /dev/xvdf


Welcome to fdisk (util-linux 2.32.1).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Device does not contain a recognized partition table.

Created a new DOS disklabel with disk identifier 0x303a9752.

Command (m for help): m

Help:

DOS (MBR)

a toggle a bootable flag

b edit nested BSD disklabel

c toggle the dos compatibility flag

Generic

d delete a partition

F list free unpartitioned space

l list known partition types

n add a new partition

p print the partition table

t change a partition type

v verify the partition table

i print information about a partition

Misc

m print this menu

u change display/entry units

x extra functionality (experts only)

Script

I load disk layout from sfdisk script file

O dump disk layout to sfdisk script file

Save & Exit

w write table to disk and exit


q quit without saving changes

Create a new label

g create a new empty GPT partition table

G create a new empty SGI (IRIX) partition table

o create a new empty DOS partition table

s create a new empty Sun partition table

Command (m for help): p

Disk /dev/xvdf: 100 GiB, 107374182400 bytes, 209715200 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

Disklabel type: dos

Disk identifier: 0x303a9752

Command (m for help):

Command (m for help): n

Partition type

p primary (0 primary, 0 extended, 4 free)

e extended (container for logical partitions)

Select (default p):

Using default response p.

Partition number (1-4, default 1):

First sector (2048-209715199, default 2048): 50gb

Value out of range.

First sector (2048-209715199, default 2048): 20gb

Value out of range.

First sector (2048-209715199, default 2048):

Last sector, +sectors or +size{K,M,G,T,P} (2048-209715199, default 209715199): 5


0gb

Value out of range.

Last sector, +sectors or +size{K,M,G,T,P} (2048-209715199, default 209715199):


Created a new partition 1 of type 'Linux' and of size 100 GiB.

Command (m for help): w

The partition table has been altered.

Calling ioctl() to re-read partition table.

Syncing disks.

[root@ip-172-31-82-165 ec2-user]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

xvdf 202:80 0 100G 0 disk

└─xvdf1 202:81 0 100G 0 part

[root@ip-172-31-82-165 ec2-user]# mkdir /nidhi

[root@ip-172-31-82-165 ec2-user]# ls -la

total 12

drwx------. 3 ec2-user ec2-user 74 Nov 11 07:49 .

drwxr-xr-x. 3 root root 22 Nov 11 07:49 ..

-rw-r--r--. 1 ec2-user ec2-user 18 Apr 21 2021 .bash_logout

-rw-r--r--. 1 ec2-user ec2-user 141 Apr 21 2021 .bash_profile

-rw-r--r--. 1 ec2-user ec2-user 376 Apr 21 2021 .bashrc

drwx------. 2 ec2-user ec2-user 29 Nov 11 07:49 .ssh

[root@ip-172-31-82-165 ec2-user]# ls

[root@ip-172-31-82-165 ec2-user]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

xvdf 202:80 0 100G 0 disk

└─xvdf1 202:81 0 100G 0 part

[root@ip-172-31-82-165 ec2-user]# sudo mkfs.ext4 /dev/xvdf1 /nidhi

mke2fs 1.45.6 (20-Mar-2020)

mkfs.ext4: invalid blocks '/nidhi' on device '/dev/xvdf1'

[root@ip-172-31-82-165 ec2-user]# sudo mkfs.ext4 /dev/xvdf1 /nidhi/

mke2fs 1.45.6 (20-Mar-2020)

mkfs.ext4: invalid blocks '/nidhi/' on device '/dev/xvdf1'

[root@ip-172-31-82-165 ec2-user]# sudo mkfs.ext4 /dev/xvdf1


mke2fs 1.45.6 (20-Mar-2020)

Creating filesystem with 26214144 4k blocks and 6553600 inodes

Filesystem UUID: 3ae8eb8d-164a-482d-af62-2fc2c0e4e9d8

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done

Writing inode tables: done

Creating journal (131072 blocks): done

Writing superblocks and filesystem accounting information: done

[root@ip-172-31-82-165 ec2-user]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

xvdf 202:80 0 100G 0 disk

└─xvdf1 202:81 0 100G 0 part

[root@ip-172-31-82-165 ec2-user]# sudo mount /dev/xvdf1 /nidhi/

[root@ip-172-31-82-165 ec2-user]# sudo vi /etc/fstab

[root@ip-172-31-82-165 ec2-user]# cd /nidhi

[root@ip-172-31-82-165 nidhi]# touch n1 n2 n3

[root@ip-172-31-82-165 nidhi]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

xvdf 202:80 0 100G 0 disk

└─xvdf1 202:81 0 100G 0 part /nidhi

[root@ip-172-31-82-165 nidhi]# ls

lost+found n1 n2 n3

[root@ip-172-31-82-165 nidhi]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

xvdf 202:80 0 100G 0 disk


└─xvdf1 202:81 0 100G 0 part /nidhi

[root@ip-172-31-82-165 nidhi]# history

1 lsblk

2 fdisk /dev/xvdf

3 lsblk

4 mkdir /nidhi

5 ls -la

6 ls

7 lsblk

8 sudo mkfs.ext4 /dev/xvdf1 /nidhi

9 sudo mkfs.ext4 /dev/xvdf1 /nidhi/

10 sudo mkfs.ext4 /dev/xvdf1

11 lsblk

12 sudo mount /dev/xvdf1 /nidhi/

13 sudo vi /etc/fstab

14 cd /nidhi

15 touch n1 n2 n3

16 lsblk

17 ls

18 lsblk

19 history

[root@ip-172-31-82-165 nidhi]#

login as: ec2-user


Authenticating with public key "imported-openssh-key"

[ec2-user@ip-172-31-92-53 ~]$ sudo su

[root@ip-172-31-92-53 ec2-user]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

[root@ip-172-31-92-53 ec2-user]#

[root@ip-172-31-92-53 ec2-user]#

[root@ip-172-31-92-53 ec2-user]#

[root@ip-172-31-92-53 ec2-user]#

[root@ip-172-31-92-53 ec2-user]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

xvdf 202:80 0 50G 0 disk

[root@ip-172-31-92-53 ec2-user]#

[root@ip-172-31-92-53 ec2-user]#

[root@ip-172-31-92-53 ec2-user]# fdisk /dev/xvdf

Welcome to fdisk (util-linux 2.32.1).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Device does not contain a recognized partition table.

Created a new DOS disklabel with disk identifier 0xe2723f5a.

Command (m for help): m

Help:
DOS (MBR)

a toggle a bootable flag

b edit nested BSD disklabel

c toggle the dos compatibility flag

Generic

d delete a partition

F list free unpartitioned space

l list known partition types

n add a new partition

p print the partition table

t change a partition type

v verify the partition table

i print information about a partition

Misc

m print this menu

u change display/entry units

x extra functionality (experts only)

Script

I load disk layout from sfdisk script file

O dump disk layout to sfdisk script file

Save & Exit

w write table to disk and exit

q quit without saving changes

Create a new label

g create a new empty GPT partition table


G create a new empty SGI (IRIX) partition table

o create a new empty DOS partition table

s create a new empty Sun partition table

Command (m for help): n

Partition type

p primary (0 primary, 0 extended, 4 free)

e extended (container for logical partitions)

Select (default p):

Using default response p.

Partition number (1-4, default 1):

First sector (2048-104857599, default 2048):

Last sector, +sectors or +size{K,M,G,T,P} (2048-104857599, default 104857599):

Created a new partition 1 of type 'Linux' and of size 50 GiB.

Command (m for help): w

The partition table has been altered.

Calling ioctl() to re-read partition table.

Syncing disks.

[root@ip-172-31-92-53 ec2-user]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

xvdf 202:80 0 50G 0 disk

└─xvdf1 202:81 0 50G 0 part

[root@ip-172-31-92-53 ec2-user]#
[root@ip-172-31-92-53 ec2-user]#

[root@ip-172-31-92-53 ec2-user]#

[root@ip-172-31-92-53 ec2-user]# mkdir sai

[root@ip-172-31-92-53 ec2-user]# ll

total 0

drwxr-xr-x. 2 root root 6 Nov 10 09:27 sai

[root@ip-172-31-92-53 ec2-user]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

xvdf 202:80 0 50G 0 disk

└─xvdf1 202:81 0 50G 0 part

[root@ip-172-31-92-53 ec2-user]# rm -sai

rm: invalid option -- 's'

Try 'rm --help' for more information.

[root@ip-172-31-92-53 ec2-user]# rm sai

rm: cannot remove 'sai': Is a directory

[root@ip-172-31-92-53 ec2-user]# rd sai

bash: rd: command not found

[root@ip-172-31-92-53 ec2-user]# mkdir /swetha

[root@ip-172-31-92-53 ec2-user]# ls

sai

[root@ip-172-31-92-53 ec2-user]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

xvdf 202:80 0 50G 0 disk

└─xvdf1 202:81 0 50G 0 part

[root@ip-172-31-92-53 ec2-user]#
[root@ip-172-31-92-53 ec2-user]# cd /

[root@ip-172-31-92-53 /]# ls

bin data etc lib media opt root sbin swetha tmp var

boot dev home lib64 mnt proc run srv sys usr

[root@ip-172-31-92-53 /]# ls -la

total 16

dr-xr-xr-x. 19 root root 250 Nov 10 09:30 .

dr-xr-xr-x. 19 root root 250 Nov 10 09:30 ..

lrwxrwxrwx. 1 root root 7 Apr 23 2020 bin -> usr/bin

dr-xr-xr-x. 5 root root 4096 Nov 10 09:06 boot

drwxr-xr-x. 2 root root 6 May 4 2021 data

drwxr-xr-x. 18 root root 2700 Nov 10 09:22 dev

drwxr-xr-x. 87 root root 8192 Nov 10 09:06 etc

drwxr-xr-x. 3 root root 22 Nov 10 09:06 home

lrwxrwxrwx. 1 root root 7 Apr 23 2020 lib -> usr/lib

lrwxrwxrwx. 1 root root 9 Apr 23 2020 lib64 -> usr/lib64

drwxr-xr-x. 2 root root 6 Apr 23 2020 media

drwxr-xr-x. 2 root root 6 Apr 23 2020 mnt

drwxr-xr-x. 2 root root 6 Apr 23 2020 opt

dr-xr-xr-x. 95 root root 0 Nov 10 09:05 proc

dr-xr-x---. 3 root root 149 Nov 10 09:06 root

drwxr-xr-x. 23 root root 660 Nov 10 09:06 run

lrwxrwxrwx. 1 root root 8 Apr 23 2020 sbin -> usr/sbin

drwxr-xr-x. 2 root root 6 Apr 23 2020 srv

drwxr-xr-x. 2 root root 6 Nov 10 09:30 swetha

dr-xr-xr-x. 13 root root 0 Nov 10 09:05 sys

drwxrwxrwt. 8 root root 172 Nov 10 09:32 tmp

drwxr-xr-x. 12 root root 144 May 4 2021 usr

drwxr-xr-x. 20 root root 278 Nov 10 09:05 var

[root@ip-172-31-92-53 /]# sudo mkfs.ext4 /dev/xvdf1

mke2fs 1.45.6 (20-Mar-2020)


Creating filesystem with 13106944 4k blocks and 3276800 inodes

Filesystem UUID: a1d91187-245d-4bab-9dfd-4505f848f9fd

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

4096000, 7962624, 11239424

Allocating group tables: done

Writing inode tables: done

Creating journal (65536 blocks): done

Writing superblocks and filesystem accounting information: done

[root@ip-172-31-92-53 /]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

xvdf 202:80 0 50G 0 disk

└─xvdf1 202:81 0 50G 0 part

[root@ip-172-31-92-53 /]# sudo mount /dev/xvdf1 /swetha

[root@ip-172-31-92-53 /]# sudo mount /dev/xvdf1 /swetha/

mount: /swetha: /dev/xvdf1 already mounted on /swetha.

[root@ip-172-31-92-53 /]#

[root@ip-172-31-92-53 /]# sudo vi /etc/fstab

[root@ip-172-31-92-53 /]# cd /swetha

[root@ip-172-31-92-53 swetha]# sudo touch a1 b2 c3

[root@ip-172-31-92-53 swetha]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

xvdf 202:80 0 50G 0 disk


└─xvdf1 202:81 0 50G 0 part /swetha

[root@ip-172-31-92-53 swetha]# cd /swetha

[root@ip-172-31-92-53 swetha]# ls

a1 b2 c3 lost+found

[root@ip-172-31-92-53 swetha]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda 202:0 0 10G 0 disk

├─xvda1 202:1 0 1M 0 part

└─xvda2 202:2 0 10G 0 part /

xvdf 202:80 0 50G 0 disk

└─xvdf1 202:81 0 50G 0 part /swetha

[root@ip-172-31-92-53 swetha]#

You might also like