Experience: is what you get soon after you need it.

Experience: is what you get soon after you need it.

Rasul Allah (sal Allahu alaihi wa sallam) said: "Restore the trusts of those who trust you, and deal not falsely with him who deals falsely with you." [Abu Dawud, Tirmidhi]

Search This Blog

Tuesday, October 31, 2017

Oracle Cloud: Disk /dev/sdb doesn't contain a valid partition table

While adding the block volume in Oracle Cloud Compute Instance I was getting the below error.
Disk /dev/sdb doesn't contain a valid partition table

Fix:
I created the partition table as shown below and rebooted the Instance.


Create the block volume and attach it to the Compute Instance.











Run the iscsi commands to attach the volume.


shaikprod@shaikprod ~/.ssh
$ ssh -i id_rsa ubuntu@129.213.47.80
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-123-generic x86_64)


ubuntu@ebsprdapp01:~$
ubuntu@ebsprdapp01:~$ id
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugde

ubuntu@ebsprdapp01:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            126G   12K  126G   1% /dev
tmpfs            26G  1.2M   26G   1% /run
/dev/sda1        46G  1.1G   43G   3% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            126G     0  126G   0% /run/shm
none            100M     0  100M   0% /run/user
/dev/sda15      105M  4.7M  100M   5% /boot/efi


ubuntu@ebsprdapp01:~$ sudo iscsiadm -m node -o new -T iqn.2015-12.com.oracleiaas:5b592336-8f01-4176-aea9-f9d9c6190ede -p 169.254.2.2:3260
sudo iscsiadm -m node -o update -T iqn.2015-12.com.oracleiaas:5b592336-8f01-4176-aea9-f9d9c6190ede -n node.startup -v automatic
sudo iscsiadm -m node -T iqn.2015-12.com.oracleiaas:5b592336-8f01-4176-aea9-f9d9c6190ede -p 169.254.2.2:3260 -l
New iSCSI node [tcp:[hw=,ip=,net_if=,iscsi_if=default] 169.254.2.2,3260,-1 iqn.2015-12.com.oracleiaas:5b592336-8f01-4176-aea9-f9d9c6190ede]

ubuntu@ebsprdapp01:~$ sudo iscsiadm -m node -o update -T iqn.2015-12.com.oracleiaas:5b592336-8f01-4176-aea9-f9d9c6190ede -n node.startup -v

ubuntu@ebsprdapp01:~$ sudo iscsiadm -m node -T iqn.2015-12.com.oracleiaas:5b592336-8f01-4176-aea9-f9d9c6190ede -p 169.254.2.2:3260 -l
Logging in to [iface: default, target: iqn.2015-12.com.oracleiaas:5b592336-8f01-4176-aea9-f9d9c6190ede, portal: 169.254.2.2,3260] (multiple)
Login to [iface: default, target: iqn.2015-12.com.oracleiaas:5b592336-8f01-4176-aea9-f9d9c6190ede, portal: 169.254.2.2,3260] successful.

ubuntu@ebsprdapp01:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            126G   12K  126G   1% /dev
tmpfs            26G  1.2M   26G   1% /run
/dev/sda1        46G  1.1G   43G   3% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            126G     0  126G   0% /run/shm
none            100M     0  100M   0% /run/user
/dev/sda15      105M  4.7M  100M   5% /boot/efi

fdsik shows that the partition table is not created for the new disk
ubuntu@ebsprdapp01:~$ sudo fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 50.0 GB, 50010783744 bytes
256 heads, 63 sectors/track, 6056 cylinders, total 97677312 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1    97677311    48838655+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table


Follow the below commands to create the partition table for the new block volume/disk

ubuntu@ebsprdapp01:~$ sudo fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xe8bf5c2e.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.

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): 1
First sector (2048-209715199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):
Using default value 209715199

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

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

ubuntu@ebsprdapp01:~$ sudo mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (4-Feb-2014)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214144 blocks
1310707 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 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

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

ubuntu@ebsprdapp01:~$ sudo echo "/dev/sdb1 /data ext4  defaults,noatime,_netdev      0 0" >>  /etc/fstab

ubuntu@ebsprdapp01:~$ cat /etc/fstab| grep data

/dev/sdb1 /data ext4  defaults,noatime,_netdev      0 0


ubuntu@ebsprdapp01:~$ sudo reboot

Broadcast message from ubuntu@ebsprdapp01
        (/dev/pts/0) at 0:08 ...

The system is going down for reboot NOW!
ubuntu@ebsprdapp01:~$ Connection to 129.213.47.80 closed by remote host.
Connection to 129.213.47.80 closed.




shaikprod@shaikprod ~/.ssh

$ ssh -i id_rsa ubuntu@129.213.47.80
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-123-generic x86_64)


Last login: Tue Oct 31 23:57:21 2017 from ool-44c4f7aa.dyn.optonline.net
ubuntu@ebsprdapp01:~$ df -k
Filesystem     1K-blocks    Used Available Use% Mounted on
udev           131994172       4 131994168   1% /dev
tmpfs           26401656    1196  26400460   1% /run
/dev/sda1       47927164 1130876  44731784   3% /
none                   4       0         4   0% /sys/fs/cgroup
none                5120       0      5120   0% /run/lock
none           132008272       0 132008272   0% /run/shm
none              102400       0    102400   0% /run/user
/dev/sda15        106858    4737    102122   5% /boot/efi
/dev/sdb1      103080224   61044  97759968   1% /data


ubuntu@ebsprdapp01:/data$ sudo chown ubuntu:ubuntu /data
ubuntu@ebsprdapp01:/data$
ubuntu@ebsprdapp01:/data$
ubuntu@ebsprdapp01:/data$ touch abc
ubuntu@ebsprdapp01:/data$ ls -lrt
total 16
drwx------ 2 root   root   16384 Nov  1 00:06 lost+found
-rw-rw-r-- 1 ubuntu ubuntu     0 Nov  1 00:43 abc


ubuntu@ebsprdapp01:/data$ pwd
/data



No comments: