Saturday, January 23, 2021

Mount point Error - mount: /dev/sdb1 is write-protected, mounting read-only

 


Error -  mount: /dev/sdb1 is write-protected, mounting read-only



[root@localhost ~]# fdisk -l


Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 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: dos

Disk identifier: 0x000d604e


   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     2099199     1048576   83  Linux

/dev/sda2         2099200    62914559    30407680   8e  Linux LVM


Disk /dev/sdb: 12.9 GB, 12884901888 bytes, 25165824 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 /dev/mapper/ol-root: 29.0 GB, 28982640640 bytes, 56606720 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 /dev/mapper/ol-swap: 2147 MB, 2147483648 bytes, 4194304 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@localhost ~]# fdisk /dev/sdb

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.


Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0xa412a5eb.


Command (m for help): p


Disk /dev/sdb: 12.9 GB, 12884901888 bytes, 25165824 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: dos

Disk identifier: 0xa412a5eb


   Device Boot      Start         End      Blocks   Id  System


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):

First sector (2048-25165823, default 2048):

Using default value 2048

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

Using default value 25165823

Partition 1 of type Linux and of size 12 GiB is set


Command (m for help): p


Disk /dev/sdb: 12.9 GB, 12884901888 bytes, 25165824 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: dos

Disk identifier: 0xa412a5eb


   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048    25165823    12581888   83  Linux


Command (m for help): w

The partition table has been altered!


Calling ioctl() to re-read partition table.

Syncing disks.

[root@localhost ~]#

[root@localhost ~]#




[root@localhost ~]#

[root@localhost ~]# mount /dev/sdb1 /backup/

mount: /dev/sdb1 is write-protected, mounting read-only

mount: unknown filesystem type '(null)'

[root@localhost ~]#



[root@localhost ~]# mount  /dev/sdb1 /backup/

mount: /dev/sdb1 is write-protected, mounting read-only

mount: unknown filesystem type '(null)'

[root@localhost ~]#




[root@localhost ~]#

[root@localhost ~]# mkfs.ext4 /dev/sdb1

mke2fs 1.42.9 (28-Dec-2013)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

786432 inodes, 3145472 blocks

157273 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2151677952

96 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


Allocating group tables: done

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done


[root@localhost ~]#

[root@localhost ~]#

[root@localhost ~]#

[root@localhost ~]# mount /dev/sdb1 /backup/

[root@localhost ~]#

[root@localhost ~]#

[root@localhost ~]# df -h

Filesystem           Size  Used Avail Use% Mounted on

devtmpfs             823M     0  823M   0% /dev

tmpfs                847M     0  847M   0% /dev/shm

tmpfs                847M  9.3M  838M   2% /run

tmpfs                847M     0  847M   0% /sys/fs/cgroup

/dev/mapper/ol-root   27G   27G  200M 100% /

/dev/sda1           1014M  217M  798M  22% /boot

tmpfs                170M  8.0K  170M   1% /run/user/42

tmpfs                170M     0  170M   0% /run/user/0

/dev/sdb1             12G   41M   12G   1% /backup

[root@localhost ~]#

[root@localhost ~]#



Entry in fstab



[root@localhost ~]# cat /etc/fstab


#

# /etc/fstab

# Created by anaconda on Wed Jul 29 17:46:25 2020

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

/dev/mapper/ol-root     /                       xfs     defaults        0 0

UUID=df8f6e5c-bd9c-4782-8a03-7d4ecc10fdd4 /boot                   xfs     defaults        0 0

/dev/mapper/ol-swap     swap                    swap    defaults        0 0


UUID=0d604fb0-3675-4e59-8bcc-2f9d8ca8d86d /backup                   ext4     defaults        0 0

[root@localhost ~]#

[root@localhost ~]#


2 comments:

  1. hey Anurag thank you so much, I dont the command mkfs ext4, I was stuck during mount. Thanks a lot!

    ReplyDelete