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

 找回密码
 立即注册
查看: 2670|回复: 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)
2 l- {) n3 o& p. e      or: fdisk /dev/sdc  (for the third SCSI disk). y4 N3 T7 B0 Y$ c. `- i; R
      or: fdisk /dev/eda  (for the first PS/2 ESDI drive)
9 z9 E; v& z$ P: \, M      or: fdisk /dev/rd/c0d0  or: fdisk /dev/ida/c0d0  (for RAID devices)3 j4 C" @# V+ n  }% M( [- k
      ...
/ @3 e2 U' c; m$ K
  1. df -k
    + G( X3 f" V8 l4 l$ j
  2. df -lh) O4 K6 R9 o1 S1 W6 Z/ W
  3. 查看有几块硬盘:fdisk -l
    ( w0 p% F0 u3 _0 T' M: X. G9 N$ b
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
! {9 A3 X9 ^, t  G0 a    /dev/sda3              3723848    705968   2828716  20% /
# x& S. H% d  I$ R& u" U% S6 R; G! i1 A    /dev/sda1               101089      9274     86596  10% /boot
( o  h  ], _; I% {/ K    none                     14520         0     14520   0% /dev/shm* \' [  v8 P$ v+ @% ?
    对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
$ E# H- {* V: {
  1. fdisk /dev/hda
复制代码
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
" s: f. O$ g* F: Q" K( z    Building a new DOS disklabel. Changes will remain in memory only,  n$ u; ~) E2 V5 I. R
    until you decide to write them. After that, of course, the previous! b% \$ w. T6 N0 N4 C# C
    content won't be recoverable.
6 [# T* I: m3 f% p  ]    The number of cylinders for this disk is set to 8322.) {9 j/ \7 q) _- r- K( I; p
    There is nothing wrong with that, but this is larger than 1024,
( g6 K8 d. _1 h    and could in certain setups cause problems with:4 m/ ?! R0 d/ _# j7 P4 F
    1) software that runs at boot time (e.g., old versions of LILO)0 b5 T) `2 F9 |$ }
    2) booting and partitioning software from other OSs  ?1 ~* W  o4 V9 p) y! h, L" t
       (e.g., DOS FDISK, OS/2 FDISK)9 c1 A! d8 n0 X5 z$ H/ w% I0 W+ ^
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
$ O1 k% f0 p' \8 _5 I. T# G; Z4 [    Command (m for help): p
% y  u. X6 }/ L: R6 r# A+ a    Disk /dev/hda: 4294 MB, 4294967296 bytes
7 u8 [  F- m4 \- }+ Q' S- Y9 |/ m! w    16 heads, 63 sectors/track, 8322 cylinders! J1 l! C' u& B; d/ s9 ?0 k& C
    Units = cylinders of 1008 * 512 = 516096 bytes$ r6 W6 G" g0 w( R6 v9 `
       Device Boot    Start       End    Blocks   Id  System
  g6 F' c2 ]  Y; m8 S    Command (m for help): m  T' [6 y% \/ I/ v( Q
    Command action
* r+ C# ~, l, r; X" z' A8 {1 x       a   toggle a bootable flag
/ w2 Q) A2 L+ u" Q5 R# X' V3 v  c       b   edit bsd disklabel. C- W8 o6 n% ?2 v  t" [0 n; `
       c   toggle the dos compatibility flag- k& M  s( k) W) q, b+ D* _
       d   delete a partition. W2 a5 c6 u) C4 w/ w: a7 n7 I- y
       l   list known partition types  Z# q& R1 R" m. e' c: a
       m   print this menu
& D  n* f* y; Y- b& C       n   add a new partition
8 a! p. Q1 L$ W5 k3 s- t" o/ d       o   create a new empty DOS partition table1 i% w1 [' h9 x* q
       p   print the partition table( E1 n4 X: T2 W. V# U1 n
       q   quit without saving changes
# G' ^! u( a# P       s   create a new empty Sun disklabel3 v) r& G5 a' v( X: l
       t   change a partition's system id
. T0 L' t/ r+ K4 Z8 z       u   change display/entry units
7 t! H+ ~: c" ^1 k% x% T       v   verify the partition table
1 k- W# C6 m/ J( @( A, f       w   write table to disk and exit
2 T* |# @- c: x; @9 O7 I4 H0 S3 G& y' A       x   extra functionality (experts only)6 v2 |4 u# Q# Q9 W6 ~
    Command (m for help): n9 B. \9 ^, s& f) J
    Command action
- f; R% c+ B$ G5 m& F1 t5 X  Z       e   extended( s1 G$ p0 d. x7 h. g
       p   primary partition (1-4)( Z% e6 {' p9 U# B7 K: C$ F4 A
    p$ w8 L/ _0 {. A% k
    Partition number (1-4): 1
) u3 n& @' L3 i6 H    First cylinder (1-8322, default 1): ( S, {! [1 E+ ~* J5 [, V# m
    Using default value 1
0 I" c9 y$ L% U, {    Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
7 g& x/ U3 E6 P5 M% X9 a    Command (m for help): p# ?% s- q& m7 _: ?$ y$ k
    Disk /dev/hda: 4294 MB, 4294967296 bytes# T# X5 Y8 }+ ^" z
    16 heads, 63 sectors/track, 8322 cylinders
& j; }8 m. f1 L0 f2 `. T$ H- z    Units = cylinders of 1008 * 512 = 516096 bytes  D( Y5 i$ W8 p! \4 R3 v5 T. X
       Device Boot    Start       End    Blocks   Id  System# {, _. N* v- [
    /dev/hda1             1      1000    503968+  83  Linux
6 r9 |' Z0 x& [" E$ w4 {  {    Command (m for help): w
3 u+ [* v# Y' A9 A; {, i    The partition table has been altered!  k2 Z' a' o2 m
    Calling ioctl() to re-read partition table.
1 g- q+ h. f  T+ G2 ~* T7 S    Syncing disks.1 R/ S+ H( O3 }
    //格式化新分区( n3 y# _1 H% D2 Q* t) S) ?; u; h# H
  1. mkfs.ext3 /dev/hda1
复制代码
mke2fs 1.32 (09-Nov-2002)
3 C: B; H3 |2 `: V4 ?, O% s    Filesystem label=
. H% \  Z) R& R: C$ V  a* I# D& Y" @, @    OS type: Linux
2 S( R) g8 ?$ j* B    Block size=1024 (log=0)
5 Y1 H3 i2 g- A7 l* t; W    Fragment size=1024 (log=0)
- G0 c2 J0 _7 o" V0 ?5 z! O3 l5 b# t    126480 inodes, 503968 blocks
7 l0 J) j0 S# R+ P4 \, h    25198 blocks (5.00%) reserved for the super user* M9 c$ K8 I$ q8 I$ w4 G) c5 T0 U; Z
    First data block=1
' ?8 \. g0 [9 u( Q    62 block groups# M. S0 |/ p. A) b5 X2 }
    8192 blocks per group, 8192 fragments per group
6 C0 A8 U# A3 u. C# i    2040 inodes per group
" K) w, J$ K( a, F6 ~$ Y& N    Superblock backups stored on blocks: 2 [0 v( u1 a; E# p3 c) z# r4 x: e
            8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409" Y0 k7 ?) f& b  C7 y4 X$ h% z
    Writing inode tables: done                           
; n' ?) |( L: `' u* L1 E    Creating journal (8192 blocks): done
+ w7 U0 W6 r: k: B) w; l3 J    Writing superblocks and filesystem accounting information: done# t+ y( d! a6 W& l) ?
    This filesystem will be automatically checked every 30 mounts or
9 i, z# o3 o% ~( O2 a  ?1 |    180 days, whichever comes first.  Use tune2fs -c or -i to override.( _' _) ^. d' ~" z" d3 h: w- Q
  1. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
# {4 l) E1 d) _    /dev/sda3              3723848    705992   2828692  20% /4 N+ B5 J7 I: v0 \! i1 J
    /dev/sda1               101089      9274     86596  10% /boot
0 p: {1 G+ a2 k6 f$ b    none                     14520         0     14520   0% /dev/shm1 s: x0 O6 W% [; P
    //挂上新分区
1 y( q, v1 S/ p
  1. mount /dev/hda1 /home
    4 }) T" Z4 H/ S% S
  2. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点9 |. }# P) y* p) N# n; [' s6 v
    /dev/sda3              3723848    705992   2828692  20% /
. Y. d6 _9 T0 O) i1 E5 M    /dev/sda1               101089      9274     86596  10% /boot6 i3 f# I( a1 f7 \( i( g
    none                     14520         0     14520   0% /dev/shm! B% j) d! i5 J( _
    /dev/hda1               488006      8239    454569   2% /home
: Y+ B! A, ~! W$ `9 a  N) G0 O3 C' O1 d& \! O
自动挂载:
, m" R8 n' i' E  T' B
  1.           vi /etc/fstab
    8 H0 `# X. h* b+ I6 `  `
  2. ' f: m, y4 l, f4 j1 b1 P$ U
  3.           /dev/sdb5 /mnt/ljp1  ext3     defaults     0 0
    # b# y% L! r, j& E3 ^
  4. 1 ]  t  c! d- }, J8 v
  5.           /dev/sdb6 /mnt/ljp2  ext3     defaults     0 0
复制代码
手动挂载:
7 j5 g8 V7 o& C( g' z# g" p/ ?9 W
  1.           mount /dev/sdb5 /mnt/ljp10 p  o) n7 i! X, M2 C5 w' D9 }- }

  2. ! m: T, R8 j  @& ]3 A
  3.           mount /dev/sdb6 /mnt/ljp2
复制代码
9 [, J$ e. Q: ?" i: Z% w, G

6 i6 A( y; I3 V9 H" h2 U1 j) Z7 {+ g4 F, b! h9 `, A4 N, h
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-12-11 15:02 , Processed in 0.037553 second(s), 6 queries , APCu On.

Powered by Discuz!

© 2010-2023.

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