Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My system currently runs an XBMC live install. I am installing a second hard drive in my system, but I am somewhat of a linux newb and only know the basics. Since it is XBMC I believe I need to do everything from the command line.

Can anyone give me a little step by step on what I need to do with the commands and proper parameters?

As an aside, I am planning on formatting as ext2. The game plan is to share this drive on my network, so I can copy files to it from my Mac running OSX. Should I use a different format?

share|improve this question
not sure what XBMC is but I would not recommend ext2, use ext3 or ext4. If you're sharing via network it doesn't matter what the local fs is. The network fs will abstract that. – xenoterracide Aug 27 '10 at 23:48
@xeno XBMC – Michael Mrozek Aug 27 '10 at 23:51
@xenoterracide Sorry I should have linked to it. It is basically a media center platform. If you would not recommend ext2, ext3, or ext4 what would you suggest or are you saying it doesn't really matter? – Jacob Schoen Aug 27 '10 at 23:52
no I'm saying I would not recommend ext2 (I only use it for /boot ). Use ext3 or ext4. The recovery capabilities are worth it... – xenoterracide Aug 28 '10 at 0:10
@xenoterracide Oh, how did I misread that. Thanks for the the suggestions. Will probably do ext3 now. The process was not the bad. – Jacob Schoen Aug 28 '10 at 0:38
up vote 4 down vote accepted

Ext2 does not do journalling. I.e. if have a power-loss or something like that, there is a probability to lose file meta-data with ext2. Plus, a fsck-run is absolutely needed after a crash which will take large amounts of time on current sized disks.

Thus, just use ext3 of xfs, which do both have journaling. mkfs.xfs runs faster. ext4 is relatively new, and one is usually a little conservative when it comes to filesystems.

If you want to use your complete disk under linux, you do not even need to partition it. You can just use /dev/sdX then when creating or mounting the disk.

If you want to partition it, use cfdisk, since it has a convenient user interface.

Be sure to use the right devices for creating the filesystem. Check via

ls /dev/hd*
ls /dev/sd*
fdisk -l

What devices are available and already in use.

hdparm -i /dev/sdX

shows the vendor/model information and size and more to double check, if you get the right device.

Create filesystem then:

 mkfs.ext3 /dev/sdX


mkfs.xfs /dev/sdX

Test to mount it via

mount /dev/sdX /mnt/point

If the mount point does not exist, you have to create it first via mkdir.

You can change the ownership of the base directory after mounting it via

chown user:group /mnt/point

To mount the disk after each boot, usually you configure it via /etc/fstab

/dev/sdX /mnt/point auto auto,defaults 0 0

Since you use a Live-CD, perhaps they have a different style of configuration.

To check if some hardware problems happened during mkfs you can enter


and check the most recent output.

On alternative to having to specify a device name in fstab is to specify a label during filesystem creation (e.g. mkfs.ext3 -L name) and use LABEL=name in the fstab (or with mount) instead of the device name.

share|improve this answer
Thanks for the info and the easier process. I did end up going ahead and using ext3 as everyone seemed to suggest. – Jacob Schoen Aug 28 '10 at 19:49

So I am not sure if this is correct or the best way but this is what I did and it seems to work:

  1. As root: fdisk -l to see all the partitions and find how mine is listed. It will be something like /dev/sda1. As a note the drive I installed has been used before so it had existing partitions. With an un-partitioned drive I have a feeling this will not work.

  2. As root: fdisk /dev/sda to run fdisk. You drop the number off the end to get the physical drive name.
    Type: p to list the partitions on the drive again. This is mainly a sanity check to make sure you are working on the correct drive.
    If you have partitions on the drive you need to delete then type d and follow the prompts to delete them.
    Type: n to create a new partition.
    It will prompt you to create an extended or primary partition. I did primary so I did p.
    It will then prompt for partition number. I did 1.
    It will then prompt for first cylinder number. I just hit enter for the default of 1.
    It will then prompt for the last cylinder number. I just did the default based on my disk size and hit enter.
    You can the type p again to verify the new partition is entered correctly.
    Type t to enter the hex code for the type of partition you want. I did 83 for ext2.
    Type w to write the partition table.

  3. As root: mkfs -t ext2 /dev/sda1 to actually format the partition.
  4. As root: fsck -f -y /dev/sda to check the drive, and set it up to be mounted upon each reboot.
  5. Reboot your box.
share|improve this answer
fdisk is such a pita. I avoid it if I can... cfdisk is much nicer on cli. – xenoterracide Aug 28 '10 at 1:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.