How to Mount a Drive with Right Filesystem?

21,077

If you're new, gparted is probably your friend as it's quite user-friendly for both the above options. Use it to create three partitions on /dev/xvdc of the required size for your partioning scheme.

Once installed, run it as root:

gparted /dev/xvdc

Make sure you create the filesystems as well as the partitions.

Use ext4 for the partition filesystems - ext2 is old. Other filesystems are available (eg xfs or btrfs), but for now, stick to ext4.


As @terdon mentions, you may have to add the partitions/filesystems using the command line:

Note: the # are my comments - do not enter them.

fdisk /dev/xvdc
o # letter o for oscar to create a new partition table
n # to create a new partition
p # to make this new partition a primary one
1 # to number the partition (it will be /dev/xvdc1)
[Enter] # Press enter to accept the default start position of this new parition
+500G to make it approx 50% of the size of your 1TB disk

Repeat the above commands from the o for the second and third partitions, remembering to use 2 and 3 for the parition numbers and +250G for partition 3 size and leaving it as the default on the third partition (which will use the rest of the disk space).

You now have three empty partitions. Use:

mkfs.ext4 /dev/xvdc1
mkfs.ext4 /dev/xvdc2
mkfs.ext4 /dev/xvdc3

Once your partitions are created, you can mount them.

Your mount syntax above is incorrect. You need to tell the mount command which partition you want mounted (you've told it to use the whole disk):

mount -t ext2 /dev/xvdc1 /bkp

That will only work, if the partition on /dev/xvdc1 is an ext2 partition as you've used the -t ext2 option. It's best to leave this option out and allow mount to autodetect the filesystem type:

mount /dev/xvdc1 /bkp

and so on...

Share:
21,077

Related videos on Youtube

Chris
Author by

Chris

Learning programing and helping out at Rockbridge Online Seminary.

Updated on September 18, 2022

Comments

  • Chris
    Chris almost 2 years

    I am trying to mount the device /dev/xvdc on my CentOS system. When I run an fdisk command I get:

    Device Boot      Start         End      Blocks   Id  System
    /dev/xvda1   *           1          33      262144   83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/xvda2                  33       13055   104594432   83  Linux 
    Disk /dev/xvdc: 1073.7 GB, 1073741824000 bytes 255 heads, 63
    sectors/track, 130541 cylinders Units = cylinders of 16065 * 512 =
    8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier:
    0x00000000
    

    And when I run mount -t ext2 /dev/xvdc /bkp a, I get:

    mount: wrong fs type, bad option, bad superblock on /dev/xvdc,
         missing codepage or helper program, or other error
         In some cases useful info is found in syslog - try
         dmesg | tail  or so
    

    I want /dev/xvdc to be mounted as 50% /bkp, 25% /fsys, and 25% /home2 What am I doing wrong?

  • garethTheRed
    garethTheRed almost 10 years
    You're completely right - I miss read it even after editing your question! I'll edit the answer for you...
  • terdon
    terdon almost 10 years
    @Chris I deleted my answer now that gareth edited his so I'm answering your comment here. Yes, gparted is just a piece of software like any other. You can install it wherever you like. If you don't have a GUI, you can use fdisk instead.
  • Chris
    Chris almost 10 years
    @garethTheRed - Same result. Shows the three partitions xvdc1,xdvc2,xdvc3 but when mounting get the same error. Device Boot Start End Blocks Id System /dev/xvdc1 1 38246 307210963+ 83 Linux /dev/xvdc2 38247 82866 358410150 83 Linux /dev/xvdc3 82867 130541 382949437+ 83 Linux mount -t ext4 /dev/xvdc1 /bkp mount: wrong fs type, bad option, bad superblock on /dev/xvdc1, missing codepage or helper program, or other error In some cases useful info is found in syslog
  • garethTheRed
    garethTheRed almost 10 years
    Did you create a filesystem on each partition? If you didn't do so in gparted then mkfs.ext4 /dev/xvdc1 and so on...
  • Chris
    Chris almost 10 years
    @garethTheRed - I used fdisk and I did forget this step which solved the problem. Thanks for the help and patience.