第一篇:蓝冰互联电信独立IP和双线共享IPVPS LINUX系统挂载分区的方法
蓝冰互联VPS,CENTOS系统挂载分区的方法。
1、# fdisk-l查看当前磁盘信息,就会发现最下面显示新加入的硬盘不是有效分区,如下: Disk /dev/sdc: 1500.3 GB, ***16 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table2、# fdisk /dev/sdc对新硬盘分区,并根据提示进一步操作
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel.Changes will remain in memory only,until you decide to write them.After that, of course, the previous
content won't be recoverable.The number of cylinders for this disk is set to 182401.There is nothing wrong with that, but this is larger than 1024,and could in certain setups cause problems with:
1)software that runs at boot time(e.g., old versions of LILO)
2)booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command(m for help): h输入h可查看帮助命令
h: unknown command
Command action
atoggle a bootable flag
bedit bsd disklabel
ctoggle the dos compatibility flag
ddelete a partition
llist known partition types
mprint this menu
nadd a new partition
ocreate a new empty DOS partition table
pprint the partition table
qquit without saving changes
screate a new empty Sun disklabel
tchange a partition's system id
uchange display/entry units
vverify the partition table
wwrite table to disk and exit
xextra functionality(experts only)
Command(m for help): n输入n进行分区
Command action
eextended
pprimary partition(1-4)
p输入p为主分区,e为逻辑分区
Partition number(1-4): 1由于是新盘我们输入1来分第一个主分区,共可以分4个主分区
First cylinder(1-182401, default 1):选择该分区的起始磁盘数,如无特殊需求强烈建议选择默认,也就是1来分区(直接按回车)
Using default value 1
Last cylinder or +size or +sizeM or +sizeK(1-182401, default 182401):定义该分区的大小,如果按默认(按回车)即是使用全部可用存储额,如分一个1G的空间,输入+1024m
Using default value 182401
Command(m for help): w写入分区
The partition table has been altered!
Calling ioctl()to re-read partition table.Syncing disks.3、# fdisk-l可以找到我们刚才分的一个分区,内容如下:
Disk /dev/sdc: 1500.3 GB, ***16 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device BootStartEndBlocksId System
/dev/sdc11182401 146513600183 Linux4、# mkfs-t ext3-c /dev/sdc1对分区使用ext3格式化,如多个分区sdc2等以此类推,因为新硬盘加了-c参数要先检测磁盘坏道,此过程万分漫长(150G),等待。。
mke2fs 1.39(29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096(log=2)
Fragment size=4096(log=2)
183156736 inodes, 366284000 blocks
18314200 blocks(5.00%)reserved for the super user
First data block=0
Maximum filesystem blocks=0
11179 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,102400000, 214990848
Checking for bad blocks(read-only test): done
Writing inode tables: done
Creating journal(32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or 180 days, whichever comes first.Use tune2fs-c or-i to override.5、# mkdir /var/samba新建挂载目录
6、# mount /dev/sdc1 /var/samba挂载新硬盘
7、# df-hl查看分区大小是否和我们预定的一样:
文件系统容量已用 可用 已用% 挂载点
/dev/sda79.5G 3.2G 5.9G 35% /
/dev/sda69.5G 151M 8.9G2% /tmp
/dev/sda519G 3.6G15G 20% /usr
/dev/sda319G 719M18G4% /home
/dev/sda2230G23G 196G 11% /var
/dev/sda199M25M69M 27% /boot
/dev/sdb1233G 156G78G 67% /var/samba2
tmpfs1008M0 1008M0% /dev/shm
/dev/sdc11.4T 198M 1.3T1% /var/samba此行为新硬盘
8、# vi /etc/fstab设置系统自动挂载硬盘,加入一行:
/dev/sdc1/var/samba2ext3defaults0 09、重启服务器,用步骤7检查一下,一切正常挂载完成,祝好运~