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

 找回密码
 立即注册
查看: 2568|回复: 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)
4 H0 ~1 H/ _( m7 k      or: fdisk /dev/sdc  (for the third SCSI disk)1 C5 m+ v. \2 t( ~1 t% i9 }/ f
      or: fdisk /dev/eda  (for the first PS/2 ESDI drive)
5 z1 @, i( I/ E1 g      or: fdisk /dev/rd/c0d0  or: fdisk /dev/ida/c0d0  (for RAID devices). _7 n4 a. ]: s8 T" m$ n, S! J
      ...
- Y! O7 b) w7 G" T
  1. df -k$ L' H0 s+ l$ }2 }0 g
  2. df -lh4 Y4 k' m" P' C" P# v( c( q1 S) |
  3. 查看有几块硬盘:fdisk -l
    , X6 }5 ?4 y, c' G/ B9 k5 E! j
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
4 q( i9 g. e3 D9 g; t) c4 t    /dev/sda3              3723848    705968   2828716  20% /' I3 z" m6 u% m
    /dev/sda1               101089      9274     86596  10% /boot( _  o% V8 l. V8 g
    none                     14520         0     14520   0% /dev/shm% }* R+ g' p/ I0 l" f' m) ~$ R
    对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用: J( ?( O$ p5 [7 F+ s
  1. fdisk /dev/hda
复制代码
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel3 t. u1 p# `2 T5 Y, k- D2 I
    Building a new DOS disklabel. Changes will remain in memory only,
8 z. F: J, \- t) h$ ^/ `    until you decide to write them. After that, of course, the previous- K0 H5 y7 c" z1 n
    content won't be recoverable.0 [, \; X6 U) B# C/ b, s" m9 f" v$ Z3 B; d
    The number of cylinders for this disk is set to 8322.
/ G$ g' x2 Z9 {3 P    There is nothing wrong with that, but this is larger than 1024,
9 p' g9 E5 a6 f1 [    and could in certain setups cause problems with:( @# \- w! A( t7 m, K2 h5 T
    1) software that runs at boot time (e.g., old versions of LILO)* S1 F/ C0 h0 N' b2 D! y  q1 H1 a
    2) booting and partitioning software from other OSs4 N" o, Z9 N7 @* f/ p+ R- I
       (e.g., DOS FDISK, OS/2 FDISK)
, y0 u! U) A9 b( o0 C- S$ ~    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
  @) O9 c( v% E+ j/ T, k8 I4 X4 p    Command (m for help): p1 W2 O  r, M! I0 J6 M
    Disk /dev/hda: 4294 MB, 4294967296 bytes
% t0 `# g& s7 k, H, E! i( V: T6 v    16 heads, 63 sectors/track, 8322 cylinders
0 o- O  Z6 X9 d: ?9 z, q' V    Units = cylinders of 1008 * 512 = 516096 bytes
3 e; s( K* |3 v# z4 \2 m       Device Boot    Start       End    Blocks   Id  System
' y  g  j3 ?1 ^  R! H    Command (m for help): m
. g: e! Z2 d# b5 P    Command action
1 C- P9 }8 |- k& M5 u       a   toggle a bootable flag5 h0 V; A5 l( Q7 t
       b   edit bsd disklabel4 j1 u  b3 R/ K, E  m9 B* z
       c   toggle the dos compatibility flag
5 `2 J) \! J$ ~' G' `       d   delete a partition/ M7 R7 O: P* c
       l   list known partition types% a0 q3 f0 f! {
       m   print this menu
1 ?. u7 v2 Z: Z       n   add a new partition. \" h; P8 G+ c! H0 l2 _2 n
       o   create a new empty DOS partition table
" [4 Q0 n6 K; w. D% C       p   print the partition table
4 t3 P! @! J/ H       q   quit without saving changes
% `5 C% a! [4 Q; w       s   create a new empty Sun disklabel
  W- K& w- C/ P. @& Y9 g" k, u& n       t   change a partition's system id
/ M1 m0 L8 c6 l6 r  n. j/ n& l       u   change display/entry units
5 e6 ]6 C0 n9 k       v   verify the partition table
1 U- @  T2 _# e7 L& \; b       w   write table to disk and exit) v" P; v5 q% f) m
       x   extra functionality (experts only)4 E2 D9 I4 _" x+ S5 `2 c% w; f; ]" R
    Command (m for help): n7 O8 k& A& Y" P& w: x# Q7 G
    Command action$ i7 n$ B! F! K. [4 O0 K/ w# X
       e   extended+ p; B6 g2 G4 K2 Z& S
       p   primary partition (1-4)( r9 Q. {4 O3 v! z% `  i3 f. ?9 T
    p
8 v+ d  B3 O/ [3 D, @    Partition number (1-4): 1
1 E; h! \5 F9 K5 M* R    First cylinder (1-8322, default 1): ! W8 ^# q" N, G
    Using default value 12 v- [3 ?! C( |% V2 W
    Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
. _# N" a- j( @    Command (m for help): p
+ s- P/ |: a9 _8 a# n, [7 l    Disk /dev/hda: 4294 MB, 4294967296 bytes' m4 [, T% e! ^6 I8 j
    16 heads, 63 sectors/track, 8322 cylinders4 m! O4 {& B& ^& N0 e/ P" O9 ]( @
    Units = cylinders of 1008 * 512 = 516096 bytes
+ Q9 w' A" C& }' F       Device Boot    Start       End    Blocks   Id  System, r- W9 _' P  u% K! U; p! [
    /dev/hda1             1      1000    503968+  83  Linux3 H7 J9 o5 V1 k% o1 j
    Command (m for help): w% v) ~" g0 E, J# B) K: }- O. l+ |
    The partition table has been altered!
: d3 Z" H" o/ _) n$ g1 R  N1 i    Calling ioctl() to re-read partition table.4 c* ~8 t$ k& S) t
    Syncing disks.
$ g. p# s4 t: u* r$ L: V    //格式化新分区
  X0 `) ~/ H0 i+ T' }; y2 j; \
  1. mkfs.ext3 /dev/hda1
复制代码
mke2fs 1.32 (09-Nov-2002)
: [' h4 `4 P& P7 I2 Y    Filesystem label=) m) P" l+ h* n' A, x
    OS type: Linux
$ l, u( _& E" [% p3 m$ {) V3 C: C    Block size=1024 (log=0)9 y- Y  F! v9 T! `1 Z- z2 ~
    Fragment size=1024 (log=0)' M1 L: i( U7 k. H2 N& }) Q( U
    126480 inodes, 503968 blocks
8 y" Q  \& b  c    25198 blocks (5.00%) reserved for the super user
& F- y6 L- _2 ]( B    First data block=17 i2 G2 [6 L# d1 ~; h# }
    62 block groups
  H! y2 h- S  r$ N0 z; `+ A    8192 blocks per group, 8192 fragments per group+ V9 }0 I3 a, |0 v8 g
    2040 inodes per group  {2 w" S& j0 N0 b& J" a- }
    Superblock backups stored on blocks: ' k( F/ E7 k' M( c; v
            8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014098 L( M, ?+ i! ]8 ~! [5 b- \1 p
    Writing inode tables: done                           
4 G' ^- ]! T2 m% j+ s( g* y# ~# L# {    Creating journal (8192 blocks): done
; g  ?) Z, ^+ G( o% h, w    Writing superblocks and filesystem accounting information: done4 g$ Z$ j) L' W. k$ s9 c7 s
    This filesystem will be automatically checked every 30 mounts or, c) R% }) ~# l! F" {
    180 days, whichever comes first.  Use tune2fs -c or -i to override.: X. K: k1 }0 }1 Z- q
  1. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
4 T+ ?/ ^- v2 W! F: D2 \* z: o    /dev/sda3              3723848    705992   2828692  20% /
: Y  x/ x8 N/ D- T    /dev/sda1               101089      9274     86596  10% /boot
( b6 o5 C( @# u# E2 T1 u0 i0 o    none                     14520         0     14520   0% /dev/shm
) g, k; u: f7 N+ Q; Q4 V- E    //挂上新分区% D" h4 _" R' k: U( C1 l# x
  1. mount /dev/hda1 /home
    0 _& C) f* K& P8 g5 Z& Q
  2. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点( p4 s7 X3 b* e* O
    /dev/sda3              3723848    705992   2828692  20% /* l1 c7 l/ c/ J: Q( f0 V& x
    /dev/sda1               101089      9274     86596  10% /boot6 b8 t" s6 l3 _; x8 Q! U( l
    none                     14520         0     14520   0% /dev/shm
8 {! [/ a& A% u; q9 i    /dev/hda1               488006      8239    454569   2% /home7 \/ i, Y; _& s" L$ l
: i3 \+ b& I( E4 f- L3 P8 G5 L
自动挂载:6 [9 X9 w& E: m8 ~- D# t  F) A
  1.           vi /etc/fstab
    - p! t  J, ^7 i% D- q% \9 C/ j3 w
  2. " ]5 K/ _0 A( }5 ^$ a
  3.           /dev/sdb5 /mnt/ljp1  ext3     defaults     0 09 U1 u) q! ?: {$ W4 \( _

  4. - R5 z: M6 s  ~  a+ L
  5.           /dev/sdb6 /mnt/ljp2  ext3     defaults     0 0
复制代码
手动挂载:
, N. }. z, y: T5 y- ^: `! E+ R
  1.           mount /dev/sdb5 /mnt/ljp14 ?6 F. J  X& H4 O

  2. 8 P% l& _3 k0 {' f
  3.           mount /dev/sdb6 /mnt/ljp2
复制代码
& k8 ?; m8 c; C

9 q3 z; j4 O4 b- l6 Y* u3 P
! P9 M$ [9 ?" I) n4 H2 R9 k
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-11-18 03:05 , Processed in 0.035161 second(s), 9 queries , APCu On.

Powered by Discuz!

© 2010-2023.

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