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

 找回密码
 立即注册
查看: 2798|回复: 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)! ]* s2 D6 ?' ~0 ^6 R5 ~, }" ]
      or: fdisk /dev/sdc  (for the third SCSI disk)4 z* }2 V$ n' y) {0 i3 u
      or: fdisk /dev/eda  (for the first PS/2 ESDI drive)1 l( y: [# f1 n# T1 v* O3 p
      or: fdisk /dev/rd/c0d0  or: fdisk /dev/ida/c0d0  (for RAID devices)
  ^0 Y4 m, t( }' I  _      ...+ [% I+ [( J: L, Z7 y
  1. df -k' Y2 \/ Y. v/ P9 E3 _
  2. df -lh
    ; ?6 D# S/ E1 j" G( e3 y
  3. 查看有几块硬盘:fdisk -l4 K& I4 K0 v9 `5 W( f+ h3 ?% y' j
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
: A6 K, Z7 C% }( z3 l    /dev/sda3              3723848    705968   2828716  20% /( a; z% u' q  g- W6 j) U& x
    /dev/sda1               101089      9274     86596  10% /boot
8 \# Y  {( t! I    none                     14520         0     14520   0% /dev/shm
& G* ~! u1 C$ x3 ^9 {1 [; R    对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用' l( |) u' c) I, J) M2 n, d4 `
  1. fdisk /dev/hda
复制代码
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
! c$ t0 c7 \9 b4 m    Building a new DOS disklabel. Changes will remain in memory only,  r, p4 w3 s. i) A
    until you decide to write them. After that, of course, the previous  G3 J9 G. |: G  {' C" t
    content won't be recoverable., ^  ~* B% u/ |' I8 ^
    The number of cylinders for this disk is set to 8322.
( ~2 p' m* g7 q4 i  A    There is nothing wrong with that, but this is larger than 1024,7 \' Z! O* S! L0 O- [( B. s* L
    and could in certain setups cause problems with:
3 l1 e3 V: T" @3 w    1) software that runs at boot time (e.g., old versions of LILO); {* h+ X5 E1 S5 e
    2) booting and partitioning software from other OSs' M) E5 D( [( I& k$ a
       (e.g., DOS FDISK, OS/2 FDISK)
  Z6 G7 c& d0 I( g    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
8 H3 d. j7 s3 |- q$ G    Command (m for help): p
9 D, S6 c5 s( }  L. \: [+ l4 U, Z    Disk /dev/hda: 4294 MB, 4294967296 bytes
. K  Q$ q3 V2 ]9 C, K( g    16 heads, 63 sectors/track, 8322 cylinders: z. E0 a$ @: @+ Q# Y9 a
    Units = cylinders of 1008 * 512 = 516096 bytes, M: H) j0 T3 b9 m, U7 N
       Device Boot    Start       End    Blocks   Id  System
0 b/ k! z# e* m2 |1 v( {+ |0 o) Z    Command (m for help): m5 S% |+ \# ]- l3 L- Z8 I
    Command action
0 O! y$ x( R- @7 J       a   toggle a bootable flag4 \' Z+ h: p! J
       b   edit bsd disklabel
" ]& A9 D4 c4 x       c   toggle the dos compatibility flag' I, m! V' C- q2 S1 t% R
       d   delete a partition
7 ^% V) s& P, y2 V/ B2 @       l   list known partition types
* h4 O$ ]8 v1 e2 v1 {! Q       m   print this menu, x: T, A) J8 }
       n   add a new partition
* n0 c2 r+ P6 j; S/ v, B+ ?5 A1 [1 u       o   create a new empty DOS partition table
% \' V) U+ d3 |* {7 T5 H       p   print the partition table: G: `2 e6 v& F
       q   quit without saving changes( I6 x0 ^5 H# d% c8 }; Z" I0 M
       s   create a new empty Sun disklabel
3 P7 n! e. g, u: d7 ^0 n       t   change a partition's system id
4 `# R0 U, ^- }* k# ~+ n* y% d5 R       u   change display/entry units# r# ^, j& |9 K/ T4 }0 K9 X
       v   verify the partition table
; |  |- `& K: F# u       w   write table to disk and exit' i0 G$ d! V/ D5 `" l: q+ z
       x   extra functionality (experts only)
. i( U# S! Y9 s3 ~6 j    Command (m for help): n# }( }: Z+ C5 u8 x
    Command action5 c1 h- p% b% V
       e   extended# Z, V* f( l% F* W* I
       p   primary partition (1-4)9 f3 F" X2 [9 S- a# w1 Y- X' ]
    p
- Q$ S. `, l/ V8 a4 y+ t! c    Partition number (1-4): 1
9 p- o; u! V6 O# l! x8 S    First cylinder (1-8322, default 1):
9 |: N# _" o  F( R, B! x    Using default value 1
! W1 b4 r1 l; f4 ~* Y    Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G3 |' q$ `" q7 R: e: ^% W
    Command (m for help): p/ B7 ~2 L9 D, G; ]! ]$ h
    Disk /dev/hda: 4294 MB, 4294967296 bytes
( k0 l2 Q4 b4 B0 T& ?    16 heads, 63 sectors/track, 8322 cylinders
; z* G6 [0 G6 O1 r9 n& X4 ?    Units = cylinders of 1008 * 512 = 516096 bytes( B9 m9 b8 Z9 q$ `* k  L$ G& O) X
       Device Boot    Start       End    Blocks   Id  System
; D8 D$ V6 B# S" O" _7 b- |( l2 W    /dev/hda1             1      1000    503968+  83  Linux
: F1 k% ]  ?0 [4 P- u* f    Command (m for help): w( _! B5 B5 d! |- F8 E" l
    The partition table has been altered!. Z7 [: P5 u$ ?
    Calling ioctl() to re-read partition table.
2 T% r2 Q3 [+ g. z+ {    Syncing disks.
9 n4 C' t) x8 V8 B/ Y( e& ~    //格式化新分区
% @' I# g3 v& u; R, ^
  1. mkfs.ext3 /dev/hda1
复制代码
mke2fs 1.32 (09-Nov-2002)0 Q" r9 [% D- V$ u5 a$ T
    Filesystem label=, ?9 O" y2 a* m/ @0 H
    OS type: Linux
: p, u% c' m0 m! ?5 R1 R( m4 f2 E    Block size=1024 (log=0)1 \9 i" c3 }& O3 A
    Fragment size=1024 (log=0)
2 X$ x: L$ ~# r; `7 H, A; V2 s    126480 inodes, 503968 blocks
$ I, d  t, y' a    25198 blocks (5.00%) reserved for the super user
: k' K2 C. C( x9 k1 q    First data block=1
; t; T, Q9 R$ @# P5 j    62 block groups
) V1 C' H1 U( H1 f0 S6 ?7 P* r    8192 blocks per group, 8192 fragments per group/ D+ h: i! s  ?& z9 Y# A. v
    2040 inodes per group
( ^. i0 Q2 M( J' l* B5 S5 r    Superblock backups stored on blocks: , `1 ~5 }, v, H" O
            8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409/ u6 J/ l4 h$ z4 G: f- R
    Writing inode tables: done                           
0 U5 @% I* v+ R9 e! T    Creating journal (8192 blocks): done
* Q" r5 {* E2 g- y, ?, v; y    Writing superblocks and filesystem accounting information: done
) I9 \0 T0 @. W  O4 v% i0 ~8 B    This filesystem will be automatically checked every 30 mounts or/ x+ s; l$ j7 z" J, Z
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
7 G% y  K3 v: F
  1. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点) R3 w6 l% u$ g, }) v& x
    /dev/sda3              3723848    705992   2828692  20% /
  l* o: t0 P, n4 X4 `8 m& ]' _8 t    /dev/sda1               101089      9274     86596  10% /boot
: X$ P4 E' b' S) n9 {    none                     14520         0     14520   0% /dev/shm/ _) A8 F1 [1 X. t+ P5 c+ J
    //挂上新分区8 k2 g* l8 G, `* [9 G1 _
  1. mount /dev/hda1 /home' c$ w# H6 O( i  L
  2. df -k
复制代码
文件系统               1K-块        已用     可用 已用% 挂载点
! @, O6 }. Y& S7 I# e& T    /dev/sda3              3723848    705992   2828692  20% /7 E; o4 {& D! C3 C& Z
    /dev/sda1               101089      9274     86596  10% /boot) g! f  v: d& R1 ?
    none                     14520         0     14520   0% /dev/shm
/ V* ?0 A  v; S: a" Q, ?2 `* l: q    /dev/hda1               488006      8239    454569   2% /home. a: B* `+ S! D! J

1 y5 t5 `1 O: r% O0 B自动挂载:
+ V5 l5 A% I* i& T
  1.           vi /etc/fstab
    1 i7 j7 A. ~' t* M. u6 ]

  2. ( B* G5 W& w; i+ {- R5 ?# a
  3.           /dev/sdb5 /mnt/ljp1  ext3     defaults     0 0
      s% m5 N- l- Z1 q9 s# V/ h3 N7 w

  4. 3 R. G- e% r8 H+ L( C6 q
  5.           /dev/sdb6 /mnt/ljp2  ext3     defaults     0 0
复制代码
手动挂载:
) ?# l# d  |9 y/ p% M% p$ Q
  1.           mount /dev/sdb5 /mnt/ljp1
    , m( R! i4 T4 F9 g9 i; _0 Y

  2. 2 Q6 \) n/ W7 P2 \, p$ k9 p/ ^
  3.           mount /dev/sdb6 /mnt/ljp2
复制代码

. M: ~% ]+ r% L# I
5 x: M. N% _* t5 v' K% ?& W8 {$ h+ a# n' F% T0 F! Q- m* M
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-1-17 07:28 , Processed in 0.016457 second(s), 8 queries , APCu On.

Powered by Discuz!

© 2010-2023.

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