Difference between revisions of "New Linux Disk"

From Richard's Wiki
Jump to: navigation, search
(Created page with "To add a new disk drive to (ubuntu) linux system, do this ([https://help.ubuntu.com/community/InstallingANewHardDrive Ubunu Community Documentation - Installing A New Hard Drive]...")
 
Line 9: Line 9:
 
** w # write partition table to disk
 
** w # write partition table to disk
 
* mkfs -t ext4 /dev/sdb1 # make an ext4 filesystem, on partition 1 of disk
 
* mkfs -t ext4 /dev/sdb1 # make an ext4 filesystem, on partition 1 of disk
* e2label /dev/sdb1 "ext4_2TB_a" # label the new filesystem
+
* tune2fs -m 1 /dev/sdb1 # change reserved blocks to only 1%
 +
* e2label /dev/sdb1 "ext4_2TB_a_WhateverYouWant" # label the new filesystem
 
* mkdir /media/disk1 # create a mount point
 
* mkdir /media/disk1 # create a mount point
 
* chmod 777 /media/disk1 # make it writeable by everyone
 
* chmod 777 /media/disk1 # make it writeable by everyone

Revision as of 20:09, 15 October 2011

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
  • 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