Thursday, March 15, 2012

Adding Disk to Linux

This procedure can be vastly different than the steps below. This is just a quick overivew on how to add a new disk to Linux.



Patitioning
#list devices
fdisk -l



#invoke fdisk for the desired drive
fdisk /dev/[device]



#Create a new partion
Command (m for help): n



#Select primary partition and size to use the entire disk
Command (m for help): p
Partition number (1-4): 1
First cylinder (1-1305): 1
Last cylinder or +size or +sizeM or +sizeK (1-1305): 1305



 #Commit changes
Command (m for help): w




 Formatting
#show existing file systems (for finding the fs type if you are just duplicating existing configuration)



df -hT


#find block size of a file system
tune2fs -l /dev/[partition name] | grep ‘Block size’



#mkfs.ext3 -b [block size] /dev/[partition name]




 Mounting



#First create a mount point
mkdir /u01



#then mount it
mount /dev/[partiton name] /u01



#verify the fs is writeable
touch /u01/test.file ; ls /u01




#set the partition to be mounted on boot by adding a line to /etc/fstab.  This is the example fstab file…


#/dev/VolGroup00/LogVol00  /                   ext3      defaults              1 1
#LABEL=/boot                   /boot              ext3      defaults              1 2
#tmpfs                            /dev/shm         tmpfs     defaults              0 0
#devpts                          /dev/pts          devpts    gid=5,mode=620   0 0
#sysfs                           /sys                 sysfs      defaults              0 0
#proc                             /proc               proc      defaults               0 0
#/dev/VolGroup00/LogVol01 swap             swap     defaults               0 0


vi /etc/fstab
/dev/[partition name] /u01                       ext3       defaults           0 3

0 comments:

Post a Comment