You have attached a new EBS volume
- Use ‘fdisk -l’ to find.
- first disk is the boot disk of your EC2
- subsequent disks are the ones you have attached.
root@host ]# fdisk -l WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own 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 Disk identifier: 7A58E4C0-415E-4B7D-A16C-A45C0AB51F11 # Start End Size Type Name 1 4096 16777182 8G Linux filesyste Linux 128 2048 4095 1M BIOS boot BIOS Boot Partition WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own Disk /dev/xvdf: 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 Disk identifier: 3A0C4EE6-31F9-42C9-BDA2-173AEB8860B9 WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own 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 Disk identifier: 7A58E4C0-415E-4B7D-A16C-A45C0AB51F11 # Start End Size Type Name 1 4096 16777182 8G Linux filesyste Linux 128 2048 4095 1M BIOS boot BIOS Boot Partition WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own Disk /dev/xvdf: 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
Review disk and partition
root@host]# fdisk /dev/xvdf WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p Disk /dev/xvdf: 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 Disk identifier: 3A0C4EE6-31F9-42C9-BDA2-173AEB8860B9 # Start End Size Type Name 1 2048 4196351 2G Linux filesyste Linux filesystem Command (m for help): m Command action d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): n Partition number (2-128, default 2): 2 First sector (34-16777182, default 4196352): Last sector, +sectors or +size{K,M,G,T,P} (4196352-16777182, default 16777182): +4G Created partition 2 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks.
Now you see the partition
[root@host]# fdisk -l WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own 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 Disk identifier: 7A58E4C0-415E-4B7D-A16C-A45C0AB51F11 # Start End Size Type Name 1 4096 16777182 8G Linux filesyste Linux 128 2048 4095 1M BIOS boot BIOS Boot Partition WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own Disk /dev/xvdf: 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 Disk identifier: 3A0C4EE6-31F9-42C9-BDA2-173AEB8860B9 # Start End Size Type Name 1 2048 4196351 2G Linux filesyste Linux filesystem 2 4196352 12584959 4G Linux filesyste
Try to format it?
root@jhost]# mkfs -t ext3 /dev/xvdf2 mke2fs 1.43.5 (04-Aug-2017) The file /dev/xvdf2 does not exist and no size was specified.
There was a warning about using kpartx
Note – kpartx is device – so all partitons have to be umounted
root@host]# kpartx /dev/xvdf -l xvdf1 : 0 4194304 /dev/xvdf 2048 xvdf2 : 0 8388608 /dev/xvdf 4196352 [root@host]# man kpartx [root@host]# kpartx /dev/xvdf -a device-mapper: reload ioctl on xvdf1 failed: Device or resource busy create/reload failed on xvdf1 device-mapper: reload ioctl on xvdf2 failed: Device or resource busy create/reload failed on xvdf2 [root@host]# umount /bkup [root@host]# kpartx /dev/xvdf -a [root@host]# mount -a [root@host]# cd /bkup
So, where is this device now? – use blkid
Now mapper has taken over – all references should now be /dev/mapper/
[root@host]# blkid /dev/xvda1: LABEL="/" UUID="75654c40-c4df-4669-8038-56fd7c03b472" TYPE="ext4" PARTLABEL="Linux" PARTU /dev/xvdf1: UUID="6c0b0af3-66e3-4261-8c6d-ab975c40fcfa" TYPE="ext3" PARTLABEL="Linux filesystem" PART /dev/mapper/xvdf1: UUID="6c0b0af3-66e3-4261-8c6d-ab975c40fcfa" TYPE="ext3" PARTLABEL="Linux filesyste /dev/mapper/xvdf2: PARTUUID="7c0a9698-0f17-4304-8809-8132abc104d4"
Now format and check
< [root@host]# mke2fs -t ext3 /dev/mapper/xvdf2 mke2fs 1.43.5 (04-Aug-2017) Creating filesystem with 1048576 4k blocks and 262144 inodes Filesystem UUID: 9096a599-40bf-4158-8107-c5a006136c99 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Allocating group tables: done Writing inode tables: done Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done
[root@host]# blkid /dev/xvda1: LABEL=”/” UUID=”75654c40-c4df-4669-8038-56fd7c03b472″ TYPE=”ext4″ PARTLABEL=”Linux” PARTU /dev/xvdf1: UUID=”6c0b0af3-66e3-4261-8c6d-ab975c40fcfa” TYPE=”ext3″ PARTLABEL=”Linux filesystem” PART /dev/mapper/xvdf1: UUID=”6c0b0af3-66e3-4261-8c6d-ab975c40fcfa” TYPE=”ext3″ PARTLABEL=”Linux filesyste /dev/mapper/xvdf2: UUID=”9096a599-40bf-4158-8107-c5a006136c99″ SEC_TYPE=”ext2″ TYPE=”ext3″ PARTUUID=” [root@host]# mount /dev/xvdf2 /tmp/mail mount: special device /dev/xvdf2 does not exist [root@host]# mount /dev/mapper/xvdf2 /tmp/mail root@host]# mount /dev/mapper/xvdf2 /tmp/mail [root@host]# mount proc on /proc type proc (rw,relatime) sysfs on /sys type sysfs (rw,relatime) devtmpfs on /dev type devtmpfs (rw,relatime,size=493864k,nr_inodes=123466,mode=755) devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000) tmpfs on /dev/shm type tmpfs (rw,relatime) /dev/xvda1 on / type ext4 (rw,noatime,data=ordered) …………. /dev/mapper/xvdf2 on /tmp/mail type ext3 (rw,relatime,data=ordered)