|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)) M# p8 _, Q# L; b
or: fdisk /dev/sdc (for the third SCSI disk)" m4 p5 z3 c2 ~+ c
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
. l) s S/ y0 p, {; B. r/ N or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)0 K, [/ k5 o! X% A! j
...
3 {! d* |$ ]; E! v- df -k$ y: D7 h% K+ K ?" c& R' X
- df -lh
$ l4 ~) ^- x3 f4 N5 o4 }" F - 查看有几块硬盘:fdisk -l$ ~; t; R' r& o% D. v6 n
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
1 V( R! B- p7 T& Z* [ E /dev/sda3 3723848 705968 2828716 20% /
- z1 p! B% T8 h O0 ^ /dev/sda1 101089 9274 86596 10% /boot0 ~) [/ o8 X/ Z
none 14520 0 14520 0% /dev/shm
& p! m$ w' T* z& D# ^* T* J 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用1 Y* \% F& b2 |0 I
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
2 m) b% p, i: {: p; o9 I" G& ^, V- c Building a new DOS disklabel. Changes will remain in memory only,& I/ V2 O8 i5 o' |
until you decide to write them. After that, of course, the previous$ C' j& C& ^! k( b$ n3 `4 i
content won't be recoverable./ k+ @& Z, B; K1 j) b
The number of cylinders for this disk is set to 8322.
8 `# f. v) {7 n5 Z N: ?, j C There is nothing wrong with that, but this is larger than 1024,, `. E; S: Y: R
and could in certain setups cause problems with:
4 @5 I: x2 d* e 1) software that runs at boot time (e.g., old versions of LILO)
, r# o; K, d4 Z0 w* L1 H, a4 F# e: g 2) booting and partitioning software from other OSs
' D1 j! Z% @0 B) R" n" ~: \ (e.g., DOS FDISK, OS/2 FDISK)
# u# C" c+ N. P5 F1 F. q Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
- j# `2 o( R5 Q8 C- D$ F0 J* a8 _- X Command (m for help): p
; h/ g- C. n- a) [' L* k Disk /dev/hda: 4294 MB, 4294967296 bytes/ j0 l7 I1 G. x$ J6 Q0 ^
16 heads, 63 sectors/track, 8322 cylinders
! J; P" ]$ R+ y2 N. ^ Units = cylinders of 1008 * 512 = 516096 bytes% Q+ |1 I# o1 Y6 }" G
Device Boot Start End Blocks Id System+ G& t( e- H2 ~
Command (m for help): m
1 Y0 F3 X2 X" B. Y0 R Command action
5 g# Z5 J" o0 \7 [! n* h; b ?' I7 H, M a toggle a bootable flag
- n: n' F7 }5 ]1 H) Z9 S0 ~9 A$ e ? b edit bsd disklabel
2 d2 L1 y T1 i9 j! k' O c toggle the dos compatibility flag' q O6 {) Q/ `, J
d delete a partition/ Z# o9 O+ s* `) L5 ~) M2 h
l list known partition types
, _0 b$ ?, ~ {' c) s' T m print this menu
# t6 g7 U k4 R8 n! E n add a new partition" m; w7 A: U& s* u
o create a new empty DOS partition table
) \+ e# [. h! l4 A4 L2 V p print the partition table
/ W: y5 ~6 a' g8 P, x& b- `/ O q quit without saving changes
; ~( }9 b$ ]2 N; q# o8 r s create a new empty Sun disklabel
, E0 \! m# R9 U8 P t change a partition's system id
" \1 ^8 e* v) F u change display/entry units
/ s% d9 `1 M! D/ \. f' y' p" J v verify the partition table
" m! ^: h( [0 p* e; x2 w w write table to disk and exit, ]/ v0 A: V8 [* k u8 O3 [; e
x extra functionality (experts only). `# d" K, {. X$ u
Command (m for help): n, k4 Q* D& m6 @3 A- E6 Q6 K
Command action4 i/ q5 N5 N- Z
e extended
& r2 `! T; B: {$ t p primary partition (1-4). G( W) y; b# M, L v. x6 P2 j7 o
p e" x0 N/ o' ^) Y$ h/ H
Partition number (1-4): 1
) ^5 Q5 K: o8 R4 P% e, ` First cylinder (1-8322, default 1): 9 S/ c( M9 |8 X' z0 @. m. _
Using default value 1
# H! g2 F$ D' b* m Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
3 T$ X. Z1 m2 ?7 p* I1 P3 H# p Command (m for help): p
7 q* D( b; t5 y% i1 V Disk /dev/hda: 4294 MB, 4294967296 bytes" I0 W3 O: k0 G$ o# t# |3 Q! f
16 heads, 63 sectors/track, 8322 cylinders% S9 a+ \# v2 f
Units = cylinders of 1008 * 512 = 516096 bytes
/ B1 l: |% i$ L0 d. B Device Boot Start End Blocks Id System9 `* n" X( Q0 y8 ^% k6 {
/dev/hda1 1 1000 503968+ 83 Linux! H! z0 P+ |! y4 a( c( o" }
Command (m for help): w
; Q8 q* n. o; c } The partition table has been altered!
) Y: h9 a7 g2 \ Calling ioctl() to re-read partition table.
; `( Y! u( C7 p$ W. }6 t Syncing disks.2 o" H ]' h" @) b2 [6 ^( y5 L
//格式化新分区
$ C/ o5 W9 {. c0 u! `4 @mke2fs 1.32 (09-Nov-2002)
! f7 r. E$ O" ~4 X1 @ Filesystem label=
/ `8 S$ F8 |: h$ i' L8 U; n OS type: Linux
2 Z, F( r, J4 J, A! T S: r0 g Block size=1024 (log=0)6 y; q! L- o f8 ^
Fragment size=1024 (log=0)! F- p5 Y3 F8 G5 l: L8 y+ A$ Z: T
126480 inodes, 503968 blocks8 s. X* U- `" @- F' B: z; p
25198 blocks (5.00%) reserved for the super user8 z x& E. `6 c8 N# D' n3 S
First data block=1
, I5 Z( @" q2 y$ n. y1 R- r% T 62 block groups" a7 [2 Y0 m, m& k
8192 blocks per group, 8192 fragments per group
7 D# ~9 H2 \* `. h 2040 inodes per group* n/ @4 u8 r, D0 T
Superblock backups stored on blocks:
! _! j8 U4 H7 f- [ 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
6 ~% E9 D( H' Z$ u Writing inode tables: done
, G" t, z2 `! s( Y4 t6 v9 \0 l" k Creating journal (8192 blocks): done" q! |5 M+ a, {9 f# ?, E2 }- |% W
Writing superblocks and filesystem accounting information: done
6 u! V4 A b3 T/ c- a) y% k0 T This filesystem will be automatically checked every 30 mounts or
0 K0 W- F3 ?* V0 J1 H 180 days, whichever comes first. Use tune2fs -c or -i to override.
6 ]: A/ m `1 q) E! ~1 s文件系统 1K-块 已用 可用 已用% 挂载点7 L' L2 B4 q# k4 }: f
/dev/sda3 3723848 705992 2828692 20% /( {) M9 S3 S/ @, n
/dev/sda1 101089 9274 86596 10% /boot F( l' R- J6 N8 i1 E% [# k
none 14520 0 14520 0% /dev/shm
3 y& S$ J- N. ~ [ //挂上新分区
y/ ^) `8 g- O* e- mount /dev/hda1 /home- s, ]* N# l' J! ?
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点4 I5 \+ ^$ `+ m7 B* L( l9 m% o! S
/dev/sda3 3723848 705992 2828692 20% /8 ?% h1 [4 X; o3 q4 H* K: U) m
/dev/sda1 101089 9274 86596 10% /boot# M: f; a. s9 \5 t' ~
none 14520 0 14520 0% /dev/shm: E% j# U+ T4 a
/dev/hda1 488006 8239 454569 2% /home
% c- a) t+ E4 G# ?' I8 N7 X
3 t. |5 ?1 x) t3 Y$ p自动挂载:
1 o0 a3 \4 w) Q' o- vi /etc/fstab% E# l8 N% k; y: I7 T
- $ {! A8 u& `. ^! Y% _
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 00 ~1 u' ~# _3 p! u- U
) @8 j( O. d! Q' Z3 ]! K- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:' p! b7 s, Y5 Y: s, D8 b
- mount /dev/sdb5 /mnt/ljp1
! q/ @3 {7 i) L, M, @& S
+ E) b$ b6 R2 |# a+ p0 B- mount /dev/sdb6 /mnt/ljp2
复制代码 % q8 K5 e% v& m8 m3 Q. r! L
2 l! f2 N+ m3 r& R7 `* j x5 ^- L+ ?: [& D
|
|