Saturday, May 2, 2020

Add new hardware

This document incudes detailed steps to add second hard drive to Linux OS.

1.     Determin Drive Information:
Sudo lshw –C disk
2.     Prtition the disk
3.     Format the disk
mkfs -t ext4 /dev/sdb1
4.     Mount on boot
Determine Drive Information
eo@userver:/var/www/templates/sbs/html$ sudo lshw -C disk
[sudo] password for leo:
Sorry, try again.
[sudo] password for leo:
       description: SCSI Disk
       physical id: 0.0.0
       bus info: scsi@2:0.0.0
       logical name: /dev/sdb
       size: 600GiB (644GB)
       description: ATA Disk
       product: VMware Virtual I
       physical id: 0.0.0
       bus info: scsi@0:0.0.0
       logical name: /dev/sda
       version: 0000
       serial: 00000000000000000001
       size: 127GiB (136GB)
       capabilities: partitioned partitioned:dos
       configuration: ansiversion=5 signature=0005b925
       description: DVD-RAM writer
       physical id: 0.0.0
       bus info: scsi@1:0.0.0
       logical name: /dev/cdrom
       logical name: /dev/dvd
       logical name: /dev/sr0
       capabilities: audio cd-r cd-rw dvd dvd-r dvd-ram
      configuration: status=open

Partition the disk

# sudo fdisk /dev/sdb

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the DOS compatibility flag
   d   delete a partition
   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
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-1258291199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1258291199, default 1258291199):
Using default value 1258291199

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks

Format harddisk:
root@userver:/dev# mkfs -t ext4 /dev/sdb1
mke2fs 1.42 (29-Nov-2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
39321600 inodes, 157286144 blocks
7864307 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
4800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

Monut dirve at boot
  /dev/sdb1    /media/mynewdrive   ext4   defaults     0        2

The "2" at the end instructs your system to run a quick file system check on the hard drive at every boot. Changing it to "0" will skip this. Run 'man fstab' for more info here.

S3 replication cross region to another account

preparation create the above buckets in two AWS accounts source: leo-functions destination: leo-functions-rep Create IAM role in source acco...