Hard disk mount in linux system

  
        

Newly added hard disk mounting method:

fdisk -l## Here is a view of several hard disks on the current system

Disk/dev/sda: 36.4 GB, 36401479680 bytes< Br>

255heads, 63 sectors/track, 4425 cylinders

Units =cylinders of 16065 * 512 = 8225280 bytes

DeviceBoot Start End Blocks Id System

/dev /sda1* 1 255 2048256 83 Linux

/dev/sda2256 1530 10241437+ 83 Linux

/dev/sda34296 4425 1044225 82 Linux swap

/dev/sda41531 4295 22209862 + f Win95 Ext'd (LBA)

/dev/sda51531 2805 10241406 83 Linux

/dev/sda62806 4295 11968393+ 83 Linux

Partitiontable entries are not in disk Order

Disk/dev/sdb: 36.7 GB, 36703918080 bytes ## Found here /dev/sdb, capacity 36.7G, and not partitioned

255heads, 63 sectors/track, 4462 cylinders

Units =cylinders of 16065 * 512 = 8225280 bytes

Disk/de v/sdc doesn't contain a valid partition table

Connect the hard disk on the server, start linux, and log in as root.

For example, if I add a new SCSI hard disk, I need to divide it into three areas:

#fdisk/dev/sdb

Enter fdisk mode:

Command(m for help):p //View the partition of the new hard disk

Command(m for help):n //Create a new partition

You can use the m command to see the internals of the fdisk command. The n command creates a new partition; the d command deletes an existing partition; the p command displays the partition list; the t command modifies the partition type ID number; the l command displays the partition ID number list; the a command specifies the boot partition; the w command specifies Save the changes to the partition table to make it work.

Commandaction

eextended //Enter e to create an extended partition

p primarypartition (1-4) //Enter p to create the primary partition, here we choose p

Partionnumber(1-4):1 //The first extended partition, you can divide up to 4 primary partitions according to your needs

FirstCylinder(1-1014,default 1): 1 //The number of disk blocks starting from a primary partition

Lastcylindet or +siza or +sizeM or +sizeK: +1024MB //can be a number in MB or as

disk blocks Here, we enter +1024MB to indicate that the partition size is 1G.

So we will create a partition, if you want to create more partitions, you can continue to create according to the above steps.

Save the partition with w after creation.

Command(m for help): w

Thepartition table has been altered!

Callingioctl() to re-read partition table.

Syncingdisks.

This is the partition, we have to format

#mkfs -text3 -c /dev/sdb1 //If there are multiple partitions, the partition is modified to sdb2

After formatting, we need to mount the partition,

#mkdirwww //Create the /www directory, we will hang the new partition under www

#mount/dev/Sdb1 /www //mount /dev/sdb1 to /www

# df //View with df command

Filesystem1K-blocks Used Available Use% Mounted on

/dev/sda23771316 1388956 2190788 39% /

/dev/sda1101089 9463 86407 10% /boot

none62988 0 62988 0% /dev/shm

/dev/Sdb1485906 8239 452580 2% /www //See, this is the partition we just newly mounted


Here we are nearing the end of the work, but if we end this way , Every time they have to restart the server after

manually mount, so a lot of trouble, we need to modify /etc /fstab file to automatically mount.

#vi/etc/fstab

Add the following at the end of the file:

/dev/sdb1/www ext3 defaults 1 2

There are multiple partitions to modify sdb1 and /www, save after modification, and restart the server.

At this point we are finished adding new hard drives.

After the mount, you need to restart the machine

If the disk is mounted incorrectly, you need to enter the /etc/fstab file

to delete the drive letter with the mount error

/dev/sdb1 /data1 ext3 defaults 1 1

Restart the machine

Copyright © Windows knowledge All Rights Reserved