- Check what is the new hard disk device name with "fdisk -l", it should be something like /dev/sdb. You can easily identify which is the new drive by running "mount" and finding the drive that exists in "fdisk -l" but is not mounted.
mount; fdisk -l;
- Create a partition on the new drive, (the sample code assumes the disk is /dev/sdb)
echo -ne "n\np\n1\n\n\nw\n" | fdisk /dev/sdb1
- Create a filesystem on the new partition, we use ext3 file system.
mkfs.ext3 /dev/sdb1
- Create a directory where to mount the partition
mkdir /mount/data2
- Edit /etc/fstab an add a record for the new drive at the end of the file. This will make the server mount the drive automatically after reboot. Mount options (like noatime and nodiratime) can be added as a comma separated list of values after "defaults": "defaults,noatime,nodiratime"
echo "/dev/sdb1 /mount/data2 ext3 defaults 0 0" >> /etc/fstab
nodiratime does the same thing but for directories. I know the beginners guide says to use both mount options on filesystems, but from others I've talked to and places I've read it seems noatime implies nodiratime because noatime is a superset and nodiratime is a subset used specifically to disable it for directories but leave it on for files, and when you use noatime, it does it for everything, files/dirs
echo "/dev/sdb1 /mount/data2 ext3 rw,noatime,nodiratime 0 0" >> /etc/fstabMount the drive. "mount -a" just mounts everything according to /etc/fstab.
mount -a
- Restart the server to make sure it starts ok with the new drive mounted.
shutdown -r now
No comments:
Post a Comment