稳定互联,中美互联,站长交流,虚拟主机,香港主机,美国主机,虚拟空间,免费空间,免费VPS,免费域名

 找回密码
 立即注册
查看: 2838|回复: 0

[经验] linux下添加新硬盘方法

[复制链接]
发表于 2014-2-9 19:20:26 | 显示全部楼层 |阅读模式
  1. fdisk
复制代码
Usage: fdisk [-l] [-b SSZ] [-u] device    E.g.: fdisk /dev/hda  (for the first IDE disk)+ }- s7 W9 M1 Y7 V
      or: fdisk /dev/sdc  (for the third SCSI disk)! S" \8 D- [, B: n) P
      or: fdisk /dev/eda  (for the first PS/2 ESDI drive)" K. |0 x9 p. N" h/ g+ Y& M: `; s3 {6 W1 X
      or: fdisk /dev/rd/c0d0  or: fdisk /dev/ida/c0d0  (for RAID devices)
+ d- m5 `1 t: S: O# [. l      ...+ _: R, T8 J( s& e' B
  1. df -k
    $ u; A3 z  I# j; A7 @5 U
  2. df -lh2 U4 \+ l; z' F5 w
  3. 查看有几块硬盘:fdisk -l& }5 v6 }/ c; u9 j/ U% ]6 ^+ p, q  B
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
% c$ C3 \$ V- B4 ~$ N1 H    /dev/sda3              3723848    705968   2828716  20% /
) |) x6 G4 m3 Z0 S. c$ f- x# p    /dev/sda1               101089      9274     86596  10% /boot
# a! X* T1 w  j! D6 W' ?6 B    none                     14520         0     14520   0% /dev/shm
6 R% X4 w0 k9 K    对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
3 A$ G; o1 |) n4 W) F! E
  1. fdisk /dev/hda
复制代码
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
7 W+ Q& Y4 E% L* v    Building a new DOS disklabel. Changes will remain in memory only,
& D$ v6 J- m% A2 g5 W    until you decide to write them. After that, of course, the previous1 }( m% I7 r; _2 E) F5 n" d$ c, h+ I5 F
    content won't be recoverable.8 l9 O  z' a5 Z( @
    The number of cylinders for this disk is set to 8322.
4 c4 H2 Z5 a/ B: `9 \( [    There is nothing wrong with that, but this is larger than 1024,
5 P1 d3 p6 V6 ]  O/ o    and could in certain setups cause problems with:; H) W) q: N+ o- i# Y
    1) software that runs at boot time (e.g., old versions of LILO)
7 k- J' I  w$ `; r* q    2) booting and partitioning software from other OSs
* D$ F& ]+ L2 `' y: ?       (e.g., DOS FDISK, OS/2 FDISK)0 s3 L/ |' M: N8 m1 z
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
3 Y7 n* S- y: n: [5 Q    Command (m for help): p
6 L, W$ Y7 Q+ R7 A( \7 t, n    Disk /dev/hda: 4294 MB, 4294967296 bytes
! G# b+ Q% `, k, m& y) F2 u$ v0 T    16 heads, 63 sectors/track, 8322 cylinders: l1 m5 v" e- o6 M
    Units = cylinders of 1008 * 512 = 516096 bytes6 l* R5 q+ ?' _% l  z& V/ H( K6 f
       Device Boot    Start       End    Blocks   Id  System
2 h' R. l# y# v# o+ f( p    Command (m for help): m
( s9 f8 n' K" n0 h0 g( z3 S4 u    Command action
5 Q6 v4 s6 y3 ~8 j1 N! x: z/ ~       a   toggle a bootable flag' Z( r' o& q5 {( W: G$ c
       b   edit bsd disklabel
" A3 E4 U  c9 g" ?4 s       c   toggle the dos compatibility flag* ^: x9 }3 i. X$ u" N4 L3 [
       d   delete a partition
" O9 a, K! I. f2 [       l   list known partition types
7 K, W0 ^! w, z1 V' O       m   print this menu
( d( @  w) s8 I2 A7 A       n   add a new partition" a( [( `# A; ~
       o   create a new empty DOS partition table1 ?* t* n+ a$ n8 @
       p   print the partition table, b3 s1 n/ Y2 N! }: u- N
       q   quit without saving changes
8 S$ [) v& m* p" u- S) l       s   create a new empty Sun disklabel
& S  m9 T  N# C% j7 R6 K4 ~9 |. s       t   change a partition's system id
" H% x& O  x. v; z- p" E       u   change display/entry units: L$ P, z6 o& q0 [
       v   verify the partition table5 p7 e6 h8 ^2 M& S! A
       w   write table to disk and exit2 [% ~+ u% W! @6 e- `  v0 @
       x   extra functionality (experts only)
9 n3 ^+ W" {4 F6 @1 j    Command (m for help): n2 @& C, B* S% R5 L3 G' C* u$ o
    Command action+ k- D1 D! n/ f% s. P) |( [; e
       e   extended) v6 ?9 G& v$ V+ @$ e1 e; t
       p   primary partition (1-4)- r: E$ M9 Z: N3 t9 W
    p( j1 H# K/ I, p! L% y8 L5 B
    Partition number (1-4): 1
+ s# B. G3 i( b  Z    First cylinder (1-8322, default 1):
+ P. S$ f; c5 W( K! p) t' ^" {    Using default value 1
' z8 Z! c9 j" c7 D    Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G% h3 E2 q- m' x4 \) k$ J6 P
    Command (m for help): p! i# Z  A( \" x6 ~$ K7 W5 I. t
    Disk /dev/hda: 4294 MB, 4294967296 bytes9 f) c0 ]  a. a$ p4 _
    16 heads, 63 sectors/track, 8322 cylinders
3 N( S, p/ w$ a' U) o1 P    Units = cylinders of 1008 * 512 = 516096 bytes
. k+ `; W0 w) q" T( P' Z       Device Boot    Start       End    Blocks   Id  System" W- a  d% s( [
    /dev/hda1             1      1000    503968+  83  Linux
9 Z# ~# p4 u0 E' e6 P" k  J) e5 o    Command (m for help): w
7 B3 d( m9 v' ~" j# P    The partition table has been altered!! \4 t# p3 }; C( ~
    Calling ioctl() to re-read partition table.
* x6 b/ w9 n6 Y$ j: b    Syncing disks.
6 q, I- A- a% x8 [    //格式化新分区6 {  X/ n3 M* z5 I' ]
  1. mkfs.ext3 /dev/hda1
复制代码
mke2fs 1.32 (09-Nov-2002)3 M* f: U# E  _) b% A
    Filesystem label=
. M% Z! y7 `& z    OS type: Linux
' `3 c6 J; p8 k+ J4 R" ?    Block size=1024 (log=0)
# F0 [5 m: u1 ?9 `+ j+ t. I' \    Fragment size=1024 (log=0)2 g1 @7 ]  Y7 w+ A  {# c4 A0 x  b1 {
    126480 inodes, 503968 blocks! [0 V, W5 o% v! D
    25198 blocks (5.00%) reserved for the super user
2 V2 Q. b# Q, U* R6 |    First data block=12 G6 I4 c% _1 i; f# W% w; Z9 {
    62 block groups- r6 \% k/ y/ A9 z1 g& ~
    8192 blocks per group, 8192 fragments per group6 o: g; A, u1 O$ x7 c
    2040 inodes per group9 i1 J& |4 F& B/ _
    Superblock backups stored on blocks: ' F* ^4 t1 p( M2 t- I6 L4 X
            8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409; J' L1 U' t) ]) F' a% e+ N
    Writing inode tables: done                           
8 R# ^% g( e% Q0 c  P4 @" Z    Creating journal (8192 blocks): done
% ]6 P: |  Y! D- S    Writing superblocks and filesystem accounting information: done
1 Q2 y# }) x/ e1 u( i  C    This filesystem will be automatically checked every 30 mounts or
2 A$ O7 O6 b  u  e    180 days, whichever comes first.  Use tune2fs -c or -i to override.2 ]8 U1 [  j1 j9 x8 C5 |
  1. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点0 @/ a( a: G: M4 `
    /dev/sda3              3723848    705992   2828692  20% /
2 n4 w5 v1 I3 Z5 X% ^    /dev/sda1               101089      9274     86596  10% /boot8 u1 _# u! y, L% e0 Y. c$ a( t
    none                     14520         0     14520   0% /dev/shm
9 j/ i+ G" ^" v$ M1 ~4 e: p    //挂上新分区
' j! ^- K8 H. D8 |$ a& s# j
  1. mount /dev/hda1 /home2 D" Z2 i) t& P' ]
  2. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
  z; I  W+ G# Y; J  l    /dev/sda3              3723848    705992   2828692  20% /% y: h- {/ I6 z' c0 E. j) u  `
    /dev/sda1               101089      9274     86596  10% /boot
8 \3 C( D2 P! ?8 A/ t    none                     14520         0     14520   0% /dev/shm8 L3 e; _  o! o6 ~/ W( ^
    /dev/hda1               488006      8239    454569   2% /home; R) `4 ?$ z5 `8 x# S+ j

3 L. i. j* c, x自动挂载:) R1 A& ^7 X* D; h3 {8 @# m4 r$ E" i( m
  1.           vi /etc/fstab. W9 L1 l& u0 F) f

  2. - M+ G0 b* ?' m5 Y; a
  3.           /dev/sdb5 /mnt/ljp1  ext3     defaults     0 0% s5 l; _8 M6 s& W5 M

  4. % E) D  [/ i) k
  5.           /dev/sdb6 /mnt/ljp2  ext3     defaults     0 0
复制代码
手动挂载:
' j) ]. H( Q+ }5 {4 l- w, \$ [3 r  ~
  1.           mount /dev/sdb5 /mnt/ljp1+ R& u9 |2 e: P/ ~
  2. / q6 T2 R1 `( B1 @
  3.           mount /dev/sdb6 /mnt/ljp2
复制代码

" B. z/ M% P* u9 V0 J& C: o8 ~2 R0 M7 `" }

  M1 Z9 W; H( s3 Z1 U
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|WdidcNet ( 苏ICP备17005075号-1 )

GMT+8, 2026-1-23 22:03 , Processed in 0.034263 second(s), 8 queries , APCu On.

Powered by Discuz!

© 2010-2023.

快速回复 返回顶部 返回列表