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

 找回密码
 立即注册
查看: 2683|回复: 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)5 ^4 K( l" J9 \: O/ v+ P
      or: fdisk /dev/sdc  (for the third SCSI disk)
' c' A9 Q7 _- h3 m# Y0 ^* F      or: fdisk /dev/eda  (for the first PS/2 ESDI drive)
7 s, }. F; l2 P2 q) `      or: fdisk /dev/rd/c0d0  or: fdisk /dev/ida/c0d0  (for RAID devices)
: b7 T: _( N: E      ...% i6 F) _/ }# z8 v( p& n7 ^
  1. df -k
    * T4 V+ ?. p0 l  ]
  2. df -lh8 \) U- D3 ^# ?- [2 {# M# J5 N2 K
  3. 查看有几块硬盘:fdisk -l
    * s! F1 ^" u2 G6 [5 S( o( \
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点8 t7 {" C7 I% V) _$ a- \+ v; ~: W
    /dev/sda3              3723848    705968   2828716  20% /( |9 b, H# A3 E( \
    /dev/sda1               101089      9274     86596  10% /boot
9 Q0 n3 r& N7 n. R    none                     14520         0     14520   0% /dev/shm
  N5 t( a  @/ X+ C& ]  G; _% {: S    对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用9 C7 e7 x4 m9 \& F( t. E
  1. fdisk /dev/hda
复制代码
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
* r2 B/ U4 {$ Q) n; T/ Q$ v    Building a new DOS disklabel. Changes will remain in memory only,. O' S, k4 u( ~& n- I1 p/ T
    until you decide to write them. After that, of course, the previous
, {9 K( \3 |) _4 {  T8 n    content won't be recoverable.
) U2 r1 @7 E* o    The number of cylinders for this disk is set to 8322.0 i, f" A  i! B" n4 H! }
    There is nothing wrong with that, but this is larger than 1024,' k1 n$ u% a: e- H; X
    and could in certain setups cause problems with:
# C; H( f, f* R* i* i6 O& L    1) software that runs at boot time (e.g., old versions of LILO)
, X: G2 N4 j5 _- ?  Q' I    2) booting and partitioning software from other OSs6 A6 l: P, X& Q! A6 b- C: I
       (e.g., DOS FDISK, OS/2 FDISK)5 ?" q, \* N& Z, L# Q- @2 i
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
# g4 V7 ^0 e9 w. j7 Q# s    Command (m for help): p
, x. S1 u. ?& K: J9 v- C    Disk /dev/hda: 4294 MB, 4294967296 bytes2 Z- X7 s6 v+ ?; d- p' f9 x
    16 heads, 63 sectors/track, 8322 cylinders  ]7 D2 b% q# c
    Units = cylinders of 1008 * 512 = 516096 bytes. p1 r. q! G, S* M" ^
       Device Boot    Start       End    Blocks   Id  System0 ^6 H' Y% \) A
    Command (m for help): m4 A5 a; {" W( C. z. }: G
    Command action2 q% O( y+ @; B  f% m
       a   toggle a bootable flag
1 c  [0 t9 v/ G6 g& ^       b   edit bsd disklabel& E: V: T1 Z/ s2 Z) v* Y& u/ x
       c   toggle the dos compatibility flag
# J0 q) h- T, A6 M% q2 A       d   delete a partition
; m9 e1 A/ s- v/ D) s% b% {+ f       l   list known partition types, o6 p( a* m$ l* A6 A4 s: f% t
       m   print this menu
2 p: u/ O/ g+ n% R# I       n   add a new partition
) Y0 S' ~, @& a3 ?2 i- z7 Z0 k       o   create a new empty DOS partition table
+ P" ~9 z& s9 ^( Z: ]& Y* U& o       p   print the partition table4 Q  e' f# r: m) a8 Y* z+ F
       q   quit without saving changes
" x- @# q% |8 d9 P0 y       s   create a new empty Sun disklabel
! Y/ p' O/ v  c+ Q' `       t   change a partition's system id
* \" l! _( f9 {7 b: r4 q# F       u   change display/entry units" p1 E; ?$ O# O+ J9 h  S
       v   verify the partition table* t$ P. S$ L. a; O3 s
       w   write table to disk and exit8 a" [% n- C5 w/ n: p! C$ Z/ o
       x   extra functionality (experts only)
; o8 j7 ^$ U( J, k2 R    Command (m for help): n
! A4 Z; }6 D9 q$ U1 K    Command action. l9 @  t) W; L. l) i' p
       e   extended0 g+ ]( h- i  }9 C8 H- p- n
       p   primary partition (1-4)* P& ^/ d$ N6 }, U  F
    p7 ^. L. c1 Y: w( |! s
    Partition number (1-4): 1
* @2 W5 o! H6 E. D7 ?0 l    First cylinder (1-8322, default 1):
( \& I. A  k1 P7 ]    Using default value 1! \* S" ^" H' W  s8 s
    Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G$ }3 K3 _" x! y0 Q1 T9 V
    Command (m for help): p# W2 @1 `; U) N: l# \/ s
    Disk /dev/hda: 4294 MB, 4294967296 bytes
' v& U( Q' S8 x; o0 b4 _5 ^    16 heads, 63 sectors/track, 8322 cylinders
- c& V6 T5 d; J" ?  |    Units = cylinders of 1008 * 512 = 516096 bytes& @5 Q% D0 [2 |  z4 X( e
       Device Boot    Start       End    Blocks   Id  System* E( g- A& ?4 H1 l: [2 V9 _, p
    /dev/hda1             1      1000    503968+  83  Linux" x7 o5 h, x( i! D
    Command (m for help): w7 G9 M: j9 |7 {/ A3 I
    The partition table has been altered!1 o: G& }5 d3 e  C- {1 }* J. g  D0 p
    Calling ioctl() to re-read partition table.
! M$ e/ ?- t2 c    Syncing disks.3 Q8 z! I0 b: @' i: t. S# G) M
    //格式化新分区
( N0 L1 n# \6 k) Z
  1. mkfs.ext3 /dev/hda1
复制代码
mke2fs 1.32 (09-Nov-2002); R& M1 ^- F/ g2 }
    Filesystem label=
- I# s! C7 P7 x6 `. S) e    OS type: Linux) G0 o; G; M& [
    Block size=1024 (log=0)7 P3 n0 ?: U, z: m
    Fragment size=1024 (log=0)
7 F; w1 S" j2 o    126480 inodes, 503968 blocks
- }7 u7 {( X- A    25198 blocks (5.00%) reserved for the super user1 e' r9 s; c2 A/ G
    First data block=1* N! a  p; P1 V, h, p0 O
    62 block groups' ^& f. i4 r5 j( V
    8192 blocks per group, 8192 fragments per group) X# |! F, d; V" c8 w. P4 C
    2040 inodes per group, `9 M/ s" q3 Z9 S4 Q0 n. Y  v
    Superblock backups stored on blocks:
8 G" x, k! r! j) h' w# Y" }5 S) e            8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
( I# h& I7 Y3 M7 U    Writing inode tables: done                           
7 C3 H* [$ m' v+ X% k5 J" L% Z$ W+ X    Creating journal (8192 blocks): done
8 i( e  A& K& r% F( \$ j    Writing superblocks and filesystem accounting information: done5 S  p1 r$ L9 `
    This filesystem will be automatically checked every 30 mounts or; X# W2 I( b- y! w' F2 _1 d5 ?
    180 days, whichever comes first.  Use tune2fs -c or -i to override.( T% }& E6 d7 @5 }& c+ l) H3 W; n
  1. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点, T/ y4 `% N; t7 n9 G5 v; h: g0 K
    /dev/sda3              3723848    705992   2828692  20% /* q2 U7 {( O2 t: R# g# m
    /dev/sda1               101089      9274     86596  10% /boot
% b5 m6 z" [0 h# v8 `7 T    none                     14520         0     14520   0% /dev/shm
  f  {( J- o$ v    //挂上新分区
( \: I: h! v8 ~
  1. mount /dev/hda1 /home
      }$ Q$ R2 |3 t1 ^* {
  2. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
+ K7 I, I* U: f! M% }+ A    /dev/sda3              3723848    705992   2828692  20% /
2 Q8 ^8 ]- f/ U8 C    /dev/sda1               101089      9274     86596  10% /boot: b+ Z- l: s+ P8 m
    none                     14520         0     14520   0% /dev/shm% I6 p4 a0 n) o- h: v- V
    /dev/hda1               488006      8239    454569   2% /home0 I% \/ {$ c6 D0 {
4 O$ z# o0 ]- {, c- ?, X
自动挂载:: p: }1 Y: i  p" G" B$ E
  1.           vi /etc/fstab
    ( }% U; A: n8 y/ E

  2. 0 H0 f, P+ }( R& ?: S3 J
  3.           /dev/sdb5 /mnt/ljp1  ext3     defaults     0 0. K! ~8 q* l, x

  4. # [0 z* T, n* i# ~
  5.           /dev/sdb6 /mnt/ljp2  ext3     defaults     0 0
复制代码
手动挂载:# s' {( A6 D* d- z, X& @
  1.           mount /dev/sdb5 /mnt/ljp1# y. O, V1 K  e% W, L

  2. ! x3 M# M$ _4 z) N  }6 Y' g
  3.           mount /dev/sdb6 /mnt/ljp2
复制代码

$ C7 }0 ~( Q5 q9 x* |+ A
% R7 i, I( O9 A& s1 r) l' l3 `, _9 `3 M8 \8 L( F" t
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-12-14 11:27 , Processed in 0.029376 second(s), 8 queries , APCu On.

Powered by Discuz!

© 2010-2023.

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