New Linux Disk

From Richard's Wiki
Revision as of 20:11, 15 October 2011 by Rkdrm (Talk | contribs)

Jump to: navigation, search

To add a new disk drive to (ubuntu) linux system, do this (Ubunu Community Documentation - Installing A New Hard Drive):

  • sudo bash # need to run as root
  • lshw -C disk # to list drives in the machine
    • From lshw find the logical name of the new drive. Say /dev/sdb
  • fdisk /dev/sdb # create a partition table
    • n # new partition
    • p # primary partition
    • 1 # partition 1
    • w # write partition table to disk
  • mkfs -t ext4 /dev/sdb1 # make an ext4 filesystem, on partition 1 of disk
  • tune2fs -m 1 /dev/sdb1 # change reserved blocks to only 1%
  • e2label /dev/sdb1 "ext4_2TB_a_WhateverYouWant" # label the new filesystem
  • cfdisk /dev/sdb # have a look at the partition table
  • mkdir /media/disk1 # create a mount point
  • chmod 777 /media/disk1 # make it writeable by everyone
  • edit /etc/fstab, add this (so disk is mounted at reboot):
    • /dev/sdb1 /media/disk1 ext4 defaults 0 2
  • mount /dev/sdb1