fdisk tells the disk is still NTFS, installation for RHEL7 tells its ext4?

Latest response

Hello!

Strugling to install RHEL7 on my server and all is fine until I need to add more disks to it.
Have done ALL right when using fdisk and saves it with W, also the mkfs -t ext4 /dev/DISK.
Rebooting the server, run a check and the fdisk tells the disk is still HPFS/NTFS/exFAT, do a new install of RHEL7 and marks the large disk and reclaiming the space and this ones tells me the disk is ext4.

What is wrong? And what have I missed? Are doing a new install and will post the output later. :)

Cheers
Pontus

Responses

Hi Pontus - I am guessing at this point, but it sounds like you did not "toggle" the partition type using Fdisk

# fdisk /dev/sdb
t 
1
83
w

Also - I would recommend LVM (or XFS - RHEL 7 default). If you go the LVM route, use 8e rather than 83.
You may also like using parted.

parted -s /dev/sdb mklabel gpt mkpart primary ext3 0 100% set 1 lvm on

(I need to get more familiar with RHEL 7 I think ;-)

EDIT: I forgot the ext3 in my parted command (above)

Here´s the output of the new fdisk:

[root@GEM ~]# fdisk /dev/sdb1
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 0x32260e3a.

Command (m for help): t
No partition is defined yet!

Command (m for help): p

Disk /dev/sdb1: 2000.4 GB, 2000396289024 bytes, 3907024002 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: 0x32260e3a

 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): 1
First sector (2048-3907024001, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-3907024001, default 3907024001):
Using default value 3907024001
Partition 1 of type Linux and of size 1.8 TiB is set

Command (m for help): p

Disk /dev/sdb1: 2000.4 GB, 2000396289024 bytes, 3907024002 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: 0x32260e3a

 Device Boot      Start         End      Blocks   Id  System

/dev/sdb1p1 2048 3907024001 1953510977 83 Linux

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 83
Changed type of partition 'Linux' to 'Linux'

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 22: Invalid argument.
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.
[root@GEM ~]# mkfs -t 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
122101760 inodes, 488378000 blocks
24418900 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2636120064
14905 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,
102400000, 214990848

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

[root@GEM ~]#

And after a reboot:

[root@GEM ~]# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 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: 0x0001ba75

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 976773119 487873536 8e Linux LVM

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes, 3907029168 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: 0x45c05c06

Device Boot Start End Blocks Id System
/dev/sdb1 63 3907024064 1953512001 7 HPFS/NTFS/exFAT

What is wrong with it? :/

Technically I believe your disk is under the size limitation for msdos disk labels. However, I would really consider using GPT labels.

This person has a very nice write-up
http://administratosphere.wordpress.com/2011/03/29/dos-partitions-fdisk-and-the-2tb-limit/
which refers to:
http://workingdirectory.net/posts/2010/two-tb-disks/

Based on those 2 pages, I would change my parted command a bit (change starting block and FS-type)

parted -s /dev/sdb mklabel gpt mkpart primary xfs 4096 100% set 1 lvm on

TIP: you can enclose your responses in 3 x tilde's "~~~" to keep the formatting from command output.

All points to parted, and found a new guide around this: http://duntuk.com/how-install-new-drive-linux-larger-2tb-proper-alignment

We can then close this topic and marked it as solved! :)

Great to hear it. One last "tip" - I will sometimes use gparted to manage my disks as you can see the commands it runs in the background.

Great to hear, Pontus, and thanks for the link. Hope the rest of install goes well. Please let us know if there's anything else you need help with.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.