day22

parted是一個(gè)磁盤分區(qū)管理工具

需求:

現(xiàn)有一個(gè)做了raid5的硬盤? 要求分三個(gè)去

硬盤總分區(qū)大小 6.2T

/data0? ? ? ?? 4.8T

/data1? ? ? ?? 1T

? ? ? ? ? ? ?? 4G (無(wú)需格式化? 做DRBD+Hearbeat+MySQL用)

parted /dev/sdb mklabel gpt? ? ? ? ? ? ? ? ? ?? #<==修改分區(qū)格式為gpt栗柒。

parted /dev/sdb mkpart primary 0 4800000? ? ? ? #<==創(chuàng)建一個(gè)4.8T主分區(qū)

parted /dev/sdb mkpart primary 4800001 5800001? #<==創(chuàng)建一個(gè)1T主分區(qū)

parted /dev/sdb mkpart primary 5800002 5804098? #<==創(chuàng)建一個(gè)4G主分區(qū)

parted /dev/sdb p

[root@oldboyedu ~]# parted /dev/sdb? #交互式開(kāi)始分區(qū)

GNU Parted 3.1

Using /dev/sdb

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) help

(parted) mklabel gpt? #修改分區(qū)格式為gpt? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to

continue?

Yes/No? Yes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

(parted) p? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 1074MB

Sector size (logical/physical): 512B/512B

Partition Table: gpt? #修改結(jié)果

(parted) mkpart primary 0 480? #創(chuàng)建第一個(gè)主分區(qū)480M缺脉。

Warning: The resulting partition is not properly aligned for best performance.

Ignore/Cancel? Ignore #忽略提示。? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

(parted) mkpart primary 481 580 #創(chuàng)建第二個(gè)主分區(qū)100M。

Warning: You requested a partition from 481MB to 580MB (sectors 939453..1132812).

The closest location we can manage is 481MB to 481MB (sectors 940031..940031).

Is this still acceptable to you?

Yes/No? Y? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Warning: The resulting partition is not properly aligned for best performance.

Ignore/Cancel? I #忽略提示。? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

(parted) mkpart logic 581 600 #創(chuàng)建一個(gè)20M邏輯分區(qū)。

(parted) p? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 1074MB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:

Number? Start?? End? ? Size? ? File system? Name? ?? Flags

1? ? ? 17.4kB? 480MB? 480MB? ? ? ? ? ? ? ? primary

3? ? ? 481MB?? 481MB? 512B? ? ? ? ? ? ? ?? primary

2? ? ? 481MB?? 580MB? 98.6MB? ? ? ? ? ? ?? primary

4? ? ? 581MB?? 600MB? 18.9MB? ? ? ? ? ? ?? logic

(parted) rm 4?? #刪除? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

(parted) p? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

分區(qū)被parted搞了。

修改分區(qū)格式:

(parted) mklabel msdos

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to

continue?

Yes/No? Y? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

(parted) p? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 1074MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Disk Flags:

創(chuàng)建分區(qū):

[root@oldboyedu ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): n

Partition type:

?? p?? primary (0 primary, 0 extended, 4 free)

?? e?? extended

Select (default p): p

Partition number (1-4, default 1):

First sector (2048-2097151, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +100M

Partition 1 of type Linux and of size 100 MiB is set

Command (m for help): p

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x000006b6

?? Device Boot? ? ? Start? ? ? ?? End? ? ? Blocks?? Id? System

/dev/sdb1? ? ? ? ? ? 2048? ? ? 206847? ? ? 102400?? 83? Linux

Command (m for help): n

Partition type:

?? p?? primary (1 primary, 0 extended, 3 free)

?? e?? extended

Select (default p): p

Partition number (2-4, default 2):

First sector (206848-2097151, default 206848):

Using default value 206848

Last sector, +sectors or +size{K,M,G} (206848-2097151, default 2097151): +100M

Partition 2 of type Linux and of size 100 MiB is set

Command (m for help): p

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x000006b6

?? Device Boot? ? ? Start? ? ? ?? End? ? ? Blocks?? Id? System

/dev/sdb1? ? ? ? ? ? 2048? ? ? 206847? ? ? 102400?? 83? Linux

/dev/sdb2? ? ? ? ? 206848? ? ? 411647? ? ? 102400?? 83? Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@oldboyedu ~]# ls -l /dev/sdb*

brw-rw---- 1 root disk 8, 16 Mar 29 11:31 /dev/sdb

brw-rw---- 1 root disk 8, 17 Mar 29 11:31 /dev/sdb1

brw-rw---- 1 root disk 8, 18 Mar 29 11:31 /dev/sdb2

[root@oldboyedu ~]# mkfs -t ext4 /dev/sdb1 #格式化ext4文件系統(tǒng) mkfs.ext4

其實(shí)關(guān)鍵就是生成一定數(shù)量的Inode和Block。

mke2fs 1.42.9 (28-Dec-2013)

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

Stride=0 blocks, Stripe width=0 blocks

25688 inodes, 102400 blocks

5120 blocks (5.00%) reserved for the super user

First data block=1

Maximum filesystem blocks=33685504

13 block groups

8192 blocks per group, 8192 fragments per group

1976 inodes per group

Superblock backups stored on blocks:

8193, 24577, 40961, 57345, 73729

Allocating group tables: done? ? ? ? ? ? ? ? ? ? ? ? ? ?

Writing inode tables: done? ? ? ? ? ? ? ? ? ? ? ? ? ?

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information: done

掛載:? ? 開(kāi)門鸽疾、開(kāi)窗住人使用

[root@oldboyedu ~]# mount? /dev/sdb1 /mnt #臨時(shí)掛載到/mnt

[root@oldboyedu ~]# df -h #查看掛載結(jié)果

Filesystem? ? ? Size? Used Avail Use% Mounted on

/dev/sda3? ? ? ? 19G? 1.9G?? 18G? 10% /

devtmpfs? ? ? ? 980M? 5.0M? 975M?? 1% /dev

tmpfs? ? ? ? ?? 991M? ?? 0? 991M?? 0% /dev/shm

tmpfs? ? ? ? ?? 991M?? 18M? 973M?? 2% /run

tmpfs? ? ? ? ?? 991M? ?? 0? 991M?? 0% /sys/fs/cgroup

/dev/sda1? ? ?? 253M? 136M? 118M? 54% /boot

tmpfs? ? ? ? ?? 199M? ?? 0? 199M?? 0% /run/user/0

tmpfs? ? ? ? ?? 199M? ?? 0? 199M?? 0% /run/user/1000

/dev/sdb1? ? ? ? 93M? 1.6M?? 85M?? 2% /mnt #<====已掛載。

[root@oldboyedu ~]# cat /proc/mounts? #查看掛載結(jié)果

rootfs / rootfs rw 0 0

sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0

proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0

configfs /sys/kernel/config configfs rw,relatime 0 0

/dev/sda3 / xfs rw,relatime,attr2,inode64,noquota 0 0

systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=32,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=19277 0 0

hugetlbfs /dev/hugepages hugetlbfs rw,relatime 0 0

debugfs /sys/kernel/debug debugfs rw,relatime 0 0

mqueue /dev/mqueue mqueue rw,relatime 0 0

/dev/sda1 /boot xfs rw,relatime,attr2,inode64,noquota 0 0

tmpfs /run/user/0 tmpfs rw,nosuid,nodev,relatime,size=202812k,mode=700 0 0

tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=202812k,mode=700,uid=1000,gid=1000 0 0

/dev/sdb1 /mnt ext4 rw,relatime,data=ordered 0 0 #<==已掛載训貌。

[root@oldboyedu ~]# touch /mnt/oldboy?? #<==測(cè)試制肮。

[root@oldboyedu ~]# ls /mnt

lost+found? oldboy

[root@oldboyedu /mnt]# umount /mnt

umount: /mnt: target is busy.

? ? ? ? (In some cases useful info about processes that use

? ? ? ?? the device is found by lsof(8) or fuser(1))

[root@oldboyedu /mnt]# pwd

/mnt

You have new mail in /var/spool/mail/root

[root@oldboyedu /mnt]# umount -lf /mnt? ?? #<==強(qiáng)制卸載

[root@oldboyedu /mnt]# df -h

Filesystem? ? ? Size? Used Avail Use% Mounted on

/dev/sda3? ? ? ? 19G? 1.9G?? 18G? 10% /

devtmpfs? ? ? ? 980M? 5.0M? 975M?? 1% /dev

tmpfs? ? ? ? ?? 991M? ?? 0? 991M?? 0% /dev/shm

tmpfs? ? ? ? ?? 991M?? 18M? 973M?? 2% /run

tmpfs? ? ? ? ?? 991M? ?? 0? 991M?? 0% /sys/fs/cgroup

/dev/sda1? ? ?? 253M? 136M? 118M? 54% /boot

tmpfs? ? ? ? ?? 199M? ?? 0? 199M?? 0% /run/user/0

tmpfs? ? ? ? ?? 199M? ?? 0? 199M?? 0% /run/user/1000

[root@oldboyedu ~]# mount /dev/sdb2 /opt? #沒(méi)有格式化沒(méi)法掛載

mount: /dev/sdb2 is write-protected, mounting read-only

mount: unknown filesystem type '(null)'

[root@oldboyedu ~]# mkfs.xfs /dev/sdb2? #格式化xfs文件系統(tǒng)

meta-data=/dev/sdb2? ? ? ? ? ? ? isize=512? ? agcount=4, agsize=6400 blks

? ? ? ?? =? ? ? ? ? ? ? ? ? ? ?? sectsz=512?? attr=2, projid32bit=1

? ? ? ?? =? ? ? ? ? ? ? ? ? ? ?? crc=1? ? ? ? finobt=0, sparse=0

data? ?? =? ? ? ? ? ? ? ? ? ? ?? bsize=4096?? blocks=25600, imaxpct=25

? ? ? ?? =? ? ? ? ? ? ? ? ? ? ?? sunit=0? ? ? swidth=0 blks

naming?? =version 2? ? ? ? ? ? ? bsize=4096?? ascii-ci=0 ftype=1

log? ? ? =internal log? ? ? ? ?? bsize=4096?? blocks=855, version=2

? ? ? ?? =? ? ? ? ? ? ? ? ? ? ?? sectsz=512?? sunit=0 blks, lazy-count=1

realtime =none? ? ? ? ? ? ? ? ?? extsz=4096?? blocks=0, rtextents=0

[root@oldboyedu ~]# mount -t xfs /dev/sdb2 /opt

You have new mail in /var/spool/mail/root

[root@oldboyedu ~]# df -h|grep opt

/dev/sdb2? ? ? ? 97M? 5.3M?? 92M?? 6% /opt

[root@oldboyedu ~]# touch /opt/oldgirl

[root@oldboyedu ~]# ls /opt

oldgirl

如何開(kāi)機(jī)自動(dòng)掛載?

/etc/fstab 開(kāi)機(jī)自動(dòng)掛載

幾列? 6列

[root@oldboyedu ~]# cat /etc/fstab

UUID=3a3a295f-88f8-456d-94dc-1a3eeb517c02 /? ? ? ? ? ? xfs? ?? defaults? ? ? ? ? 0? ? ? ? ? ? 0

UUID=fd2e0ca7-32be-425f-86a2-85c02b9ec5ea /boot? ? ? ? xfs? ?? defaults? ? ? ? ? 0? ? ? ? ? ? 0

UUID=79a3924b-739e-48dc-ab0c-0444b9ac6591 swap? ? ? ?? swap? ? defaults? ? ? ? ? 0? ? ? ? ? ? 0

設(shè)備? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 掛載點(diǎn)?? 文件系統(tǒng)類型? 默認(rèn)掛載選項(xiàng)? 是否備份? 是否開(kāi)機(jī)磁盤檢查

/dev/sdb2? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? /opt? ? ? ?? xfs? ?? defaults? ? ? ? ? 0? ? ? 0

mount -t xfs /dev/sdb2 /opt

[root@oldboyedu ~]# blkid

/dev/sdb1: UUID="a45b004f-2322-4dc4-a281-2a212dd2ab79" TYPE="ext4"

/dev/sdb2: UUID="7daf8142-b641-4b60-a287-4e08dfa18611" TYPE="xfs"

/dev/sda1: UUID="fd2e0ca7-32be-425f-86a2-85c02b9ec5ea" TYPE="xfs"

/dev/sda2: UUID="79a3924b-739e-48dc-ab0c-0444b9ac6591" TYPE="swap"

/dev/sda3: UUID="3a3a295f-88f8-456d-94dc-1a3eeb517c02" TYPE="xfs"

[root@oldboyedu ~]# tail -1 /etc/fstab

/dev/sdb2? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? /opt? ? ? ? ? ? ? ? ? ? xfs? ?? defaults? ? ? ? 0 0

mount -a 可以將fstab里的信息掛載弄企。

放入/etc/rc.local 實(shí)現(xiàn)自動(dòng)掛載 但不推薦超燃。

/sbin/mount -t xfs /dev/sdb2 /opt

查看:

[root@oldboyedu ~]# df -h

Filesystem? ? ? Size? Used Avail Use% Mounted on

/dev/sda3? ? ? ? 19G? 1.9G?? 18G? 10% /

devtmpfs? ? ? ? 980M? ?? 0? 980M?? 0% /dev

tmpfs? ? ? ? ?? 991M? ?? 0? 991M?? 0% /dev/shm

tmpfs? ? ? ? ?? 991M? 9.6M? 981M?? 1% /run

tmpfs? ? ? ? ?? 991M? ?? 0? 991M?? 0% /sys/fs/cgroup

/dev/sdb2? ? ? ? 97M? 5.3M?? 92M?? 6% /opt

/dev/sda1? ? ?? 253M? 136M? 118M? 54% /boot

tmpfs? ? ? ? ?? 199M? ?? 0? 199M?? 0% /run/user/0

tmpfs? ? ? ? ?? 199M? ?? 0? 199M?? 0% /run/user/1000

[root@oldboyedu ~]# df -i

Filesystem? ? ? Inodes IUsed?? IFree IUse% Mounted on

/dev/sda3? ? ? 9960960 74572 9886388? ? 1% /

devtmpfs? ? ? ? 250820?? 390? 250430? ? 1% /dev

tmpfs? ? ? ? ?? 253514? ?? 1? 253513? ? 1% /dev/shm

tmpfs? ? ? ? ?? 253514?? 724? 252790? ? 1% /run

tmpfs? ? ? ? ?? 253514? ? 16? 253498? ? 1% /sys/fs/cgroup

/dev/sdb2? ? ? ? 51200? ?? 4?? 51196? ? 1% /opt

/dev/sda1? ? ?? 131072?? 332? 130740? ? 1% /boot

tmpfs? ? ? ? ?? 253514? ?? 1? 253513? ? 1% /run/user/0

tmpfs? ? ? ? ?? 253514? ?? 1? 253513? ? 1% /run/user/1000

[root@oldboyedu ~]# blkid

/dev/sdb1: UUID="a45b004f-2322-4dc4-a281-2a212dd2ab79" TYPE="ext4"

/dev/sdb2: UUID="7daf8142-b641-4b60-a287-4e08dfa18611" TYPE="xfs"

/dev/sda1: UUID="fd2e0ca7-32be-425f-86a2-85c02b9ec5ea" TYPE="xfs"

/dev/sda2: UUID="79a3924b-739e-48dc-ab0c-0444b9ac6591" TYPE="swap"

/dev/sda3: UUID="3a3a295f-88f8-456d-94dc-1a3eeb517c02" TYPE="xfs"

查看文件系統(tǒng)內(nèi)部細(xì)節(jié):

[root@oldboyedu ~]# dumpe2fs /dev/sdb1 #查看ext文件系統(tǒng)內(nèi)部細(xì)節(jié)

[root@oldboyedu ~]# dumpe2fs /dev/sdb1|egrep -i "size"

dumpe2fs 1.42.9 (28-Dec-2013)

Filesystem features:? ? ? has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize

Block size:? ? ? ? ? ? ?? 1024

Fragment size:? ? ? ? ? ? 1024

Group descriptor size:? ? 64

Flex block group size:? ? 16

Inode size: ? ? ? ? ? 128

Journal size:? ? ? ? ? ?? 4096k

[root@oldboyedu ~]# xfs_

xfs_admin? ? ? xfs_db? ? ? ?? xfs_fsr? ? ? ? xfs_io? ? ? ?? xfs_metadump?? xfs_quota? ? ?

xfs_bmap? ? ?? xfs_estimate?? xfs_growfs? ?? xfs_logprint?? xfs_mkfile? ?? xfs_repair? ?

xfs_copy? ? ?? xfs_freeze? ?? xfs_info? ? ?? xfs_mdrestore? xfs_ncheck? ?? xfs_rtcp? ? ?

[root@oldboyedu ~]# xfs_

[root@oldboyedu ~]# xfs_info /dev/sda1

meta-data=/dev/sda1? ? ? ? ? ? ? isize=512? ? agcount=4, agsize=16384 blks

? ? ? ?? =? ? ? ? ? ? ? ? ? ? ?? sectsz=512?? attr=2, projid32bit=1

? ? ? ?? =? ? ? ? ? ? ? ? ? ? ?? crc=1? ? ? ? finobt=0 spinodes=0

data? ?? =? ? ? ? ? ? ? ? ? ? ?? bsize=4096?? blocks=65536, imaxpct=25

? ? ? ?? =? ? ? ? ? ? ? ? ? ? ?? sunit=0? ? ? swidth=0 blks

naming?? =version 2? ? ? ? ? ? ? bsize=4096?? ascii-ci=0 ftype=1

log? ? ? =internal? ? ? ? ? ? ?? bsize=4096?? blocks=855, version=2

? ? ? ?? =? ? ? ? ? ? ? ? ? ? ?? sectsz=512?? sunit=0 blks, lazy-count=1

realtime =none? ? ? ? ? ? ? ? ?? extsz=4096?? blocks=0, rtextents=0

[root@oldboyedu ~]# fsck

fsck? ? ? ?? fsck.btrfs?? fsck.cramfs? fsck.ext2? ? fsck.ext3? ? fsck.ext4? ? fsck.minix?? fsck.xfs? ?

[root@oldboyedu ~]# fsck

fsck 磁盤檢查和修復(fù)

1、正常的磁盤不能操作拘领。

2意乓、卸載掛載點(diǎn)在操作

[root@oldboyedu ~]# fsck -a /dev/sdb1

fsck from util-linux 2.23.2

/dev/sdb1: clean, 12/25688 files, 8896/102400 blocks

[root@oldboyedu ~]# mount /dev/sdb1 /mnt

[root@oldboyedu ~]# fsck -a /dev/sdb1

fsck from util-linux 2.23.2

/dev/sdb1 is mounted.

e2fsck: Cannot continue, aborting.

[root@oldboyedu ~]# e2fsck /dev/sdb1

e2fsck 1.42.9 (28-Dec-2013)

/dev/sdb1: clean, 12/25688 files, 8896/102400 blocks

[root@oldboyedu ~]# fsck -a /dev/sdb1

fsck from util-linux 2.23.2

/dev/sdb1: clean, 12/25688 files, 8896/102400 blocks

[root@oldboyedu ~]# xfs_repair /dev/sdb2

xfs_repair: /dev/sdb2 contains a mounted filesystem

xfs_repair: /dev/sdb2 contains a mounted and writable filesystem

fatal error -- couldn't initialize XFS library

[root@oldboyedu ~]# umount /opt

[root@oldboyedu ~]# xfs_repair /dev/sdb2

Phase 1 - find and verify superblock...

Phase 2 - using internal log

? ? ? ? - zero log...

? ? ? ? - scan filesystem freespace and inode maps...

? ? ? ? - found root inode chunk

Phase 3 - for each AG...

? ? ? ? - scan and clear agi unlinked lists...

? ? ? ? - process known inodes and perform inode discovery...

? ? ? ? - agno = 0

? ? ? ? - agno = 1

? ? ? ? - agno = 2

? ? ? ? - agno = 3

? ? ? ? - process newly discovered inodes...

Phase 4 - check for duplicate blocks...

? ? ? ? - setting up duplicate extent list...

? ? ? ? - check for inodes claiming duplicate blocks...

? ? ? ? - agno = 0

? ? ? ? - agno = 1

? ? ? ? - agno = 2

? ? ? ? - agno = 3

Phase 5 - rebuild AG headers and trees...

? ? ? ? - reset superblock...

Phase 6 - check inode connectivity...

? ? ? ? - resetting contents of realtime bitmap and summary inodes

? ? ? ? - traversing filesystem ...

? ? ? ? - traversal finished ...

? ? ? ? - moving disconnected inodes to lost+found ...

Phase 7 - verify and correct link counts...

done

==============================指定塊大小和inode大小格式===========================================

[root@oldboyedu ~]# mkfs -t ext4 -b 4096 -I 512 /dev/sdb3

mke2fs 1.42.9 (28-Dec-2013)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

38400 inodes, 38400 blocks

1920 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=39845888

2 block groups

32768 blocks per group, 32768 fragments per group

19200 inodes per group

Superblock backups stored on blocks:

32768

Allocating group tables: done? ? ? ? ? ? ? ? ? ? ? ? ? ?

Writing inode tables: done? ? ? ? ? ? ? ? ? ? ? ? ? ?

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information: done

[root@oldboyedu ~]# dumpe2fs /dev/sdb3|egrep -i "size"

dumpe2fs 1.42.9 (28-Dec-2013)

Filesystem features:? ? ? has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize

Block size:? ? ? ? ? ? ?? 4096

Fragment size:? ? ? ? ? ? 4096

Group descriptor size:? ? 64

Flex block group size:? ? 16

Inode size: ? ? ? ? ? ? ? 512

Required extra isize:? ?? 28

Desired extra isize:? ? ? 28

Journal size:? ? ? ? ? ?? 16M

文件刪除原理

no space left on device.

swap作用,內(nèi)存不夠時(shí)候约素,用來(lái)充當(dāng)內(nèi)存届良,一般內(nèi)存1.5倍。大于8G給8G

將來(lái)JAVA服務(wù)圣猎,內(nèi)存泄漏士葫。。送悔。

swap就會(huì)占用慢显。。欠啤。操作系統(tǒng)性能下降

[root@oldboyedu ~]# free -m

? ? ? ? ? ? ? total? ? ? ? used? ? ? ? free? ? ? shared? buff/cache?? available

Mem:? ? ? ? ?? 1980? ? ? ?? 143? ? ? ? 1689? ? ? ? ?? 9? ? ? ?? 146? ? ? ? 1671

Swap:? ? ? ? ?? 767? ? ? ? ?? 0? ? ? ?? 767

增加swap分區(qū) 100M

[root@oldboyedu ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): n

Partition type:

?? p?? primary (3 primary, 0 extended, 1 free)

?? e?? extended

Select (default e): p

Selected partition 4

First sector (718848-2097151, default 718848):

Using default value 718848

Last sector, +sectors or +size{K,M,G} (718848-2097151, default 2097151): +150M

Partition 4 of type Linux and of size 150 MiB is set

Command (m for help): p

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x000006b6

?? Device Boot? ? ? Start? ? ? ?? End? ? ? Blocks?? Id? System

/dev/sdb1? ? ? ? ? ? 2048? ? ? 206847? ? ? 102400?? 83? Linux

/dev/sdb2? ? ? ? ? 206848? ? ? 411647? ? ? 102400?? 83? Linux

/dev/sdb3? ? ? ? ? 411648? ? ? 718847? ? ? 153600?? 83? Linux

/dev/sdb4? ? ? ? ? 718848? ?? 1026047? ? ? 153600?? 83? Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

[root@oldboyedu ~]# partprobe /dev/sdb

[root@oldboyedu ~]# mkswap /dev/sdb4

Setting up swapspace version 1, size = 153596 KiB

no label, UUID=2d1ac352-4cc0-4727-8318-5526a3c309c2

[root@oldboyedu ~]# swapon -a /dev/sdb4

You have new mail in /var/spool/mail/root

[root@oldboyedu ~]# free -m

? ? ? ? ? ? ? total? ? ? ? used? ? ? ? free? ? ? shared? buff/cache?? available

Mem:? ? ? ? ?? 1980? ? ? ?? 144? ? ? ? 1673? ? ? ? ? 19? ? ? ?? 162? ? ? ? 1658

Swap:? ? ? ? ?? 917? ? ? ? ?? 0? ? ? ?? 917

修改分區(qū)格式:

[root@oldboyedu ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): n

Partition type:

?? p?? primary (0 primary, 0 extended, 4 free)

?? e?? extended

Select (default p): p

Partition number (1-4, default 1):

First sector (2048-2097151, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +100M

Partition 1 of type Linux and of size 100 MiB is set

Command (m for help): p

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x000006b6

?? Device Boot? ? ? Start? ? ? ?? End? ? ? Blocks?? Id? System

/dev/sdb1? ? ? ? ? ? 2048? ? ? 206847? ? ? 102400?? 83? Linux

Command (m for help): n

Partition type:

?? p?? primary (1 primary, 0 extended, 3 free)

?? e?? extended

Select (default p): p

Partition number (2-4, default 2):

First sector (206848-2097151, default 206848):

Using default value 206848

Last sector, +sectors or +size{K,M,G} (206848-2097151, default 2097151): +100M

Partition 2 of type Linux and of size 100 MiB is set

Command (m for help): p

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x000006b6

?? Device Boot? ? ? Start? ? ? ?? End? ? ? Blocks?? Id? System

/dev/sdb1? ? ? ? ? ? 2048? ? ? 206847? ? ? 102400?? 83? Linux

/dev/sdb2? ? ? ? ? 206848? ? ? 411647? ? ? 102400?? 83? Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@oldboyedu ~]# ls -l /dev/sdb*

brw-rw---- 1 root disk 8, 16 Mar 29 11:31 /dev/sdb

brw-rw---- 1 root disk 8, 17 Mar 29 11:31 /dev/sdb1

brw-rw---- 1 root disk 8, 18 Mar 29 11:31 /dev/sdb2

[root@oldboyedu ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): l

0? Empty? ? ? ? ?? 24? NEC DOS? ? ? ?? 81? Minix / old Lin bf? Solaris? ? ? ?

1? FAT12? ? ? ? ?? 27? Hidden NTFS Win 82? Linux swap / So c1? DRDOS/sec (FAT-

2? XENIX root? ? ? 39? Plan 9? ? ? ? ? 83? Linux? ? ? ? ?? c4? DRDOS/sec (FAT-

3? XENIX usr? ? ?? 3c? PartitionMagic? 84? OS/2 hidden C:? c6? DRDOS/sec (FAT-

4? FAT16 <32M? ? ? 40? Venix 80286? ?? 85? Linux extended? c7? Syrinx? ? ? ?

5? Extended? ? ? ? 41? PPC PReP Boot?? 86? NTFS volume set da? Non-FS data? ?

6? FAT16? ? ? ? ?? 42? SFS? ? ? ? ? ?? 87? NTFS volume set db? CP/M / CTOS / .

7? HPFS/NTFS/exFAT 4d? QNX4.x? ? ? ? ? 88? Linux plaintext de? Dell Utility?

8? AIX? ? ? ? ? ?? 4e? QNX4.x 2nd part 8e? Linux LVM? ? ?? df? BootIt? ? ? ?

9? AIX bootable? ? 4f? QNX4.x 3rd part 93? Amoeba? ? ? ? ? e1? DOS access? ?

a? OS/2 Boot Manag 50? OnTrack DM? ? ? 94? Amoeba BBT? ? ? e3? DOS R/O? ? ? ?

b? W95 FAT32? ? ?? 51? OnTrack DM6 Aux 9f? BSD/OS? ? ? ? ? e4? SpeedStor? ? ?

c? W95 FAT32 (LBA) 52? CP/M? ? ? ? ? ? a0? IBM Thinkpad hi eb? BeOS fs? ? ? ?

e? W95 FAT16 (LBA) 53? OnTrack DM6 Aux a5? FreeBSD? ? ? ?? ee? GPT? ? ? ? ? ?

f? W95 Ext'd (LBA) 54? OnTrackDM6? ? ? a6? OpenBSD? ? ? ?? ef? EFI (FAT-12/16/

10? OPUS? ? ? ? ? ? 55? EZ-Drive? ? ? ? a7? NeXTSTEP? ? ? ? f0? Linux/PA-RISC b

11? Hidden FAT12? ? 56? Golden Bow? ? ? a8? Darwin UFS? ? ? f1? SpeedStor? ? ?

12? Compaq diagnost 5c? Priam Edisk? ?? a9? NetBSD? ? ? ? ? f4? SpeedStor? ? ?

14? Hidden FAT16 <3 61? SpeedStor? ? ?? ab? Darwin boot? ?? f2? DOS secondary?

16? Hidden FAT16? ? 63? GNU HURD or Sys af? HFS / HFS+? ? ? fb? VMware VMFS? ?

17? Hidden HPFS/NTF 64? Novell Netware? b7? BSDI fs? ? ? ?? fc? VMware VMKCORE

18? AST SmartSleep? 65? Novell Netware? b8? BSDI swap? ? ?? fd? Linux raid auto

1b? Hidden W95 FAT3 70? DiskSecure Mult bb? Boot Wizard hid fe? LANstep? ? ? ?

1c? Hidden W95 FAT3 75? PC/IX? ? ? ? ?? be? Solaris boot? ? ff? BBT? ? ? ? ? ?

1e? Hidden W95 FAT1 80? Old Minix? ? ?

Command (m for help): p

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0xbc9b0906

?? Device Boot? ? ? Start? ? ? ?? End? ? ? Blocks?? Id? System

/dev/sdb1? ? ? ? ? ? 2048? ? ? 309247? ? ? 153600?? 83? Linux

/dev/sdb2? ? ? ? ? 309248? ? ? 616447? ? ? 153600?? 83? Linux

/dev/sdb3? ? ? ? ? 616448? ? ? 923647? ? ? 153600?? 83? Linux

/dev/sdb4? ? ? ? ? 923648? ?? 2097151? ? ? 586752? ? 5? Extended

/dev/sdb5? ? ? ? ? 925696? ?? 1232895? ? ? 153600?? 83? Linux

/dev/sdb6? ? ? ?? 1234944? ?? 1542143? ? ? 153600?? 83? Linux

/dev/sdb7? ? ? ?? 1544192? ?? 1851391? ? ? 153600?? 83? Linux

Command (m for help): t

Partition number (1-7, default 7): 7

Hex code (type L to list all codes): L

0? Empty? ? ? ? ?? 24? NEC DOS? ? ? ?? 81? Minix / old Lin bf? Solaris? ? ? ?

1? FAT12? ? ? ? ?? 27? Hidden NTFS Win 82? Linux swap / So c1? DRDOS/sec (FAT-

2? XENIX root? ? ? 39? Plan 9? ? ? ? ? 83? Linux? ? ? ? ?? c4? DRDOS/sec (FAT-

3? XENIX usr? ? ?? 3c? PartitionMagic? 84? OS/2 hidden C:? c6? DRDOS/sec (FAT-

4? FAT16 <32M? ? ? 40? Venix 80286? ?? 85? Linux extended? c7? Syrinx? ? ? ?

5? Extended? ? ? ? 41? PPC PReP Boot?? 86? NTFS volume set da? Non-FS data? ?

6? FAT16? ? ? ? ?? 42? SFS? ? ? ? ? ?? 87? NTFS volume set db? CP/M / CTOS / .

7? HPFS/NTFS/exFAT 4d? QNX4.x? ? ? ? ? 88? Linux plaintext de? Dell Utility?

8? AIX? ? ? ? ? ?? 4e? QNX4.x 2nd part 8e? Linux LVM? ? ?? df? BootIt? ? ? ?

9? AIX bootable? ? 4f? QNX4.x 3rd part 93? Amoeba? ? ? ? ? e1? DOS access? ?

a? OS/2 Boot Manag 50? OnTrack DM? ? ? 94? Amoeba BBT? ? ? e3? DOS R/O? ? ? ?

b? W95 FAT32? ? ?? 51? OnTrack DM6 Aux 9f? BSD/OS? ? ? ? ? e4? SpeedStor? ? ?

c? W95 FAT32 (LBA) 52? CP/M? ? ? ? ? ? a0? IBM Thinkpad hi eb? BeOS fs? ? ? ?

e? W95 FAT16 (LBA) 53? OnTrack DM6 Aux a5? FreeBSD? ? ? ?? ee? GPT? ? ? ? ? ?

f? W95 Ext'd (LBA) 54? OnTrackDM6? ? ? a6? OpenBSD? ? ? ?? ef? EFI (FAT-12/16/

10? OPUS? ? ? ? ? ? 55? EZ-Drive? ? ? ? a7? NeXTSTEP? ? ? ? f0? Linux/PA-RISC b

11? Hidden FAT12? ? 56? Golden Bow? ? ? a8? Darwin UFS? ? ? f1? SpeedStor? ? ?

12? Compaq diagnost 5c? Priam Edisk? ?? a9? NetBSD? ? ? ? ? f4? SpeedStor? ? ?

14? Hidden FAT16 <3 61? SpeedStor? ? ?? ab? Darwin boot? ?? f2? DOS secondary?

16? Hidden FAT16? ? 63? GNU HURD or Sys af? HFS / HFS+? ? ? fb? VMware VMFS? ?

17? Hidden HPFS/NTF 64? Novell Netware? b7? BSDI fs? ? ? ?? fc? VMware VMKCORE

18? AST SmartSleep? 65? Novell Netware? b8? BSDI swap? ? ?? fd? Linux raid auto

1b? Hidden W95 FAT3 70? DiskSecure Mult bb? Boot Wizard hid fe? LANstep? ? ? ?

1c? Hidden W95 FAT3 75? PC/IX? ? ? ? ?? be? Solaris boot? ? ff? BBT? ? ? ? ? ?

1e? Hidden W95 FAT1 80? Old Minix? ? ?

Hex code (type L to list all codes): 8e

Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): p? ?

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0xbc9b0906

?? Device Boot? ? ? Start? ? ? ?? End? ? ? Blocks?? Id? System

/dev/sdb1? ? ? ? ? ? 2048? ? ? 309247? ? ? 153600?? 83? Linux

/dev/sdb2? ? ? ? ? 309248? ? ? 616447? ? ? 153600?? 83? Linux

/dev/sdb3? ? ? ? ? 616448? ? ? 923647? ? ? 153600?? 83? Linux

/dev/sdb4? ? ? ? ? 923648? ?? 2097151? ? ? 586752? ? 5? Extended

/dev/sdb5? ? ? ? ? 925696? ?? 1232895? ? ? 153600?? 83? Linux

/dev/sdb6? ? ? ?? 1234944? ?? 1542143? ? ? 153600?? 83? Linux

/dev/sdb7? ? ? ?? 1544192? ?? 1851391? ? ? 153600?? 8e? Linux LVM

Command (m for help):

dd if=/dev/sda of=/dev/sdc? ? bs=512? ? count=10240

? ?? 來(lái)源? ? ? 生成文件系統(tǒng)?? block大小? 塊個(gè)數(shù)

[root@oldboyedu ~]# dd if=/dev/sda of=/dev/sdc? ? bs=512? ? count=10240

10240+0 records in

10240+0 records out

5242880 bytes (5.2 MB) copied, 0.0810606 s, 64.7 MB/s

[root@oldboyedu ~]# ls -l /dev/sdc

-rw-r--r-- 1 root root 5242880 Mar 29 09:55 /dev/sdc

[root@oldboyedu ~]# file /dev/sdc

/dev/sdc: x86 boot sector; partition 1: ID=0x83, active, starthead 32, startsector 2048, 524288 sectors; partition 2: ID=0x82, starthead 194, startsector 526336, 1572864 sectors; partition 3: ID=0x83, starthead 170, startsector 2099200, 39843840 sectors, code offset 0x63

[root@oldboyedu ~]# cat /proc/partitions

major minor? #blocks? name

?? 8? ? ?? 16? ? 1048576 sdb

?? 8? ? ?? 17? ?? 153600 sdb1

?? 8? ? ?? 18? ?? 153600 sdb2

?? 8? ? ?? 19? ?? 153600 sdb3

?? 8? ? ?? 20? ? ? ? ? 1 sdb4

?? 8? ? ?? 21? ?? 153600 sdb5

?? 8? ? ?? 22? ?? 153600 sdb6

?? 8? ? ?? 23? ?? 153600 sdb7

?? 8? ? ? ? 0?? 20971520 sda

?? 8? ? ? ? 1? ?? 262144 sda1

?? 8? ? ? ? 2? ?? 786432 sda2

?? 8? ? ? ? 3?? 19921920 sda3

? 11? ? ? ? 0? ? 1048575 sr0

[root@oldboyedu ~]# partprobe /dev/sdb

[root@oldboyedu ~]# partprobe /dev/sdb

[root@oldboyedu ~]# partprobe /dev/sdb

作業(yè):自學(xué):如何用一條fdisk命令回車完成上述分區(qū)荚藻。

需求:RAID5大小6T,已經(jīng)裝了系統(tǒng)了洁段, 額外添加4塊2T盤

現(xiàn)有一個(gè)做了RAID5的硬盤应狱,要求分三個(gè)區(qū),

硬盤總分區(qū)大徐羲俊: 6.2T

/data0? ? ? ? ?? 4.8T

/data1? ? ? ? ?? 1T

? ? ? ? ? ? ? ?? 4G (無(wú)需格式化疾呻,作DRBD+Hearbeat+MySQL高可用集群)

parted /dev/sdb mklabel gpt? ? ? ? ? ? ? ? ? ?? #<==修改分區(qū)格式為gpt。

parted /dev/sdb mkpart primary 0 4800000? ? ? ? #<==創(chuàng)建一個(gè)4.8T主分區(qū)

parted /dev/sdb mkpart primary 4800001 5800001? #<==創(chuàng)建一個(gè)1T主分區(qū)

parted /dev/sdb mkpart primary 5800002 5804098? #<==創(chuàng)建一個(gè)4G主分區(qū)

parted /dev/sdb p

=====================一鍵分區(qū)============================

parted /dev/sdb mklabel gpt? ? ? ? ? ? ? ? ? ?

parted /dev/sdb mkpart primary 0 480 I

parted /dev/sdb mkpart primary 481 580 I

parted /dev/sdb p

=========================================================

[root@oldboyedu ~]# parted /dev/sdb

GNU Parted 3.1

Using /dev/sdb

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) help

? align-check TYPE N? ? ? ? ? ? ? ? ? ? ? ? check partition N for TYPE(min|opt) alignment

? help [COMMAND]? ? ? ? ? ? ? ? ? ? ? ? ?? print general help, or help on COMMAND

? mklabel,mktable LABEL-TYPE? ? ? ? ? ? ?? create a new disklabel (partition table)

? mkpart PART-TYPE [FS-TYPE] START END? ?? make a partition

? name NUMBER NAME? ? ? ? ? ? ? ? ? ? ? ?? name partition NUMBER as NAME

? print [devices|free|list,all|NUMBER]? ?? display the partition table, available devices, free space, all found

? ? ? ? partitions, or a particular partition

? quit? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? exit program

? rescue START END? ? ? ? ? ? ? ? ? ? ? ?? rescue a lost partition near START and END

? resizepart NUMBER END? ? ? ? ? ? ? ? ? ? resize partition NUMBER

? rm NUMBER? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? delete partition NUMBER

? select DEVICE? ? ? ? ? ? ? ? ? ? ? ? ? ? choose the device to edit

? disk_set FLAG STATE? ? ? ? ? ? ? ? ? ? ? change the FLAG on selected device

? disk_toggle [FLAG]? ? ? ? ? ? ? ? ? ? ?? toggle the state of FLAG on selected device

? set NUMBER FLAG STATE? ? ? ? ? ? ? ? ? ? change the FLAG on partition NUMBER

? toggle [NUMBER [FLAG]]? ? ? ? ? ? ? ? ?? toggle the state of FLAG on partition NUMBER

? unit UNIT? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? set the default unit to UNIT

? version? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? display the version number and copyright information of GNU Parted

(parted) mklabel gpt? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to

continue?

Yes/No? Yes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

(parted) p? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 1074MB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:

Number? Start? End? Size? File system? Name? Flags

(parted) p? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 1074MB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:

Number? Start? End? Size? File system? Name? Flags

(parted)? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

(parted) mkpart primary 481 580 I

(parted) mkpart primary 481 580

Warning: You requested a partition from 481MB to 580MB (sectors 939453..1132812).

The closest location we can manage is 481MB to 481MB (sectors 940031..940031).

Is this still acceptable to you?

Yes/No? yes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Warning: The resulting partition is not properly aligned for best performance.

Ignore/Cancel? I

(parted) p? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 1074MB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:

Number? Start?? End? ? Size? ? File system? Name? ?? Flags

1? ? ? 17.4kB? 480MB? 480MB? ? ? ? ? ? ? ? primary

3? ? ? 481MB?? 481MB? 512B? ? ? ? ? ? ? ?? primary

2? ? ? 481MB?? 580MB? 98.6MB? ? ? ? ? ? ?? primary

(parted) mkpart logic 581 600

(parted) p? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 1074MB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:

Number? Start?? End? ? Size? ? File system? Name? ?? Flags

1? ? ? 17.4kB? 480MB? 480MB? ? ? ? ? ? ? ? primary

3? ? ? 481MB?? 481MB? 512B? ? ? ? ? ? ? ?? primary

2? ? ? 481MB?? 580MB? 98.6MB? ? ? ? ? ? ?? primary

4? ? ? 581MB?? 600MB? 18.9MB? ? ? ? ? ? ?? logic

(parted) help? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

? align-check TYPE N? ? ? ? ? ? ? ? ? ? ? ? check partition N for TYPE(min|opt) alignment

? help [COMMAND]? ? ? ? ? ? ? ? ? ? ? ? ?? print general help, or help on COMMAND

? mklabel,mktable LABEL-TYPE? ? ? ? ? ? ?? create a new disklabel (partition table)

? mkpart PART-TYPE [FS-TYPE] START END? ?? make a partition

? name NUMBER NAME? ? ? ? ? ? ? ? ? ? ? ?? name partition NUMBER as NAME

? print [devices|free|list,all|NUMBER]? ?? display the partition table, available devices, free space, all found

? ? ? ? partitions, or a particular partition

? quit? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? exit program

? rescue START END? ? ? ? ? ? ? ? ? ? ? ?? rescue a lost partition near START and END

? resizepart NUMBER END? ? ? ? ? ? ? ? ? ? resize partition NUMBER

? rm NUMBER? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? delete partition NUMBER

? select DEVICE? ? ? ? ? ? ? ? ? ? ? ? ? ? choose the device to edit

? disk_set FLAG STATE? ? ? ? ? ? ? ? ? ? ? change the FLAG on selected device

? disk_toggle [FLAG]? ? ? ? ? ? ? ? ? ? ?? toggle the state of FLAG on selected device

? set NUMBER FLAG STATE? ? ? ? ? ? ? ? ? ? change the FLAG on partition NUMBER

? toggle [NUMBER [FLAG]]? ? ? ? ? ? ? ? ?? toggle the state of FLAG on partition NUMBER

? unit UNIT? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? set the default unit to UNIT

? version? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? display the version number and copyright information of GNU Parted

(parted) rm 4? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

(parted) p? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 1074MB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:

[root@oldboyedu ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): l

0? Empty? ? ? ? ?? 24? NEC DOS? ? ? ?? 81? Minix / old Lin bf? Solaris? ? ? ?

1? FAT12? ? ? ? ?? 27? Hidden NTFS Win 82? Linux swap / So c1? DRDOS/sec (FAT-

2? XENIX root? ? ? 39? Plan 9? ? ? ? ? 83? Linux? ? ? ? ?? c4? DRDOS/sec (FAT-

3? XENIX usr? ? ?? 3c? PartitionMagic? 84? OS/2 hidden C:? c6? DRDOS/sec (FAT-

4? FAT16 <32M? ? ? 40? Venix 80286? ?? 85? Linux extended? c7? Syrinx? ? ? ?

5? Extended? ? ? ? 41? PPC PReP Boot?? 86? NTFS volume set da? Non-FS data? ?

6? FAT16? ? ? ? ?? 42? SFS? ? ? ? ? ?? 87? NTFS volume set db? CP/M / CTOS / .

7? HPFS/NTFS/exFAT 4d? QNX4.x? ? ? ? ? 88? Linux plaintext de? Dell Utility?

8? AIX? ? ? ? ? ?? 4e? QNX4.x 2nd part 8e? Linux LVM? ? ?? df? BootIt? ? ? ?

9? AIX bootable? ? 4f? QNX4.x 3rd part 93? Amoeba? ? ? ? ? e1? DOS access? ?

a? OS/2 Boot Manag 50? OnTrack DM? ? ? 94? Amoeba BBT? ? ? e3? DOS R/O? ? ? ?

b? W95 FAT32? ? ?? 51? OnTrack DM6 Aux 9f? BSD/OS? ? ? ? ? e4? SpeedStor? ? ?

c? W95 FAT32 (LBA) 52? CP/M? ? ? ? ? ? a0? IBM Thinkpad hi eb? BeOS fs? ? ? ?

e? W95 FAT16 (LBA) 53? OnTrack DM6 Aux a5? FreeBSD? ? ? ?? ee? GPT? ? ? ? ? ?

f? W95 Ext'd (LBA) 54? OnTrackDM6? ? ? a6? OpenBSD? ? ? ?? ef? EFI (FAT-12/16/

10? OPUS? ? ? ? ? ? 55? EZ-Drive? ? ? ? a7? NeXTSTEP? ? ? ? f0? Linux/PA-RISC b

11? Hidden FAT12? ? 56? Golden Bow? ? ? a8? Darwin UFS? ? ? f1? SpeedStor? ? ?

12? Compaq diagnost 5c? Priam Edisk? ?? a9? NetBSD? ? ? ? ? f4? SpeedStor? ? ?

14? Hidden FAT16 <3 61? SpeedStor? ? ?? ab? Darwin boot? ?? f2? DOS secondary?

16? Hidden FAT16? ? 63? GNU HURD or Sys af? HFS / HFS+? ? ? fb? VMware VMFS? ?

17? Hidden HPFS/NTF 64? Novell Netware? b7? BSDI fs? ? ? ?? fc? VMware VMKCORE

18? AST SmartSleep? 65? Novell Netware? b8? BSDI swap? ? ?? fd? Linux raid auto

1b? Hidden W95 FAT3 70? DiskSecure Mult bb? Boot Wizard hid fe? LANstep? ? ? ?

1c? Hidden W95 FAT3 75? PC/IX? ? ? ? ?? be? Solaris boot? ? ff? BBT? ? ? ? ? ?

1e? Hidden W95 FAT1 80? Old Minix? ? ?

Command (m for help): p

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0xbc9b0906

?? Device Boot? ? ? Start? ? ? ?? End? ? ? Blocks?? Id? System

/dev/sdb1? ? ? ? ? ? 2048? ? ? 309247? ? ? 153600?? 83? Linux

/dev/sdb2? ? ? ? ? 309248? ? ? 616447? ? ? 153600?? 83? Linux

/dev/sdb3? ? ? ? ? 616448? ? ? 923647? ? ? 153600?? 83? Linux

/dev/sdb4? ? ? ? ? 923648? ?? 2097151? ? ? 586752? ? 5? Extended

/dev/sdb5? ? ? ? ? 925696? ?? 1232895? ? ? 153600?? 83? Linux

/dev/sdb6? ? ? ?? 1234944? ?? 1542143? ? ? 153600?? 83? Linux

/dev/sdb7? ? ? ?? 1544192? ?? 1851391? ? ? 153600?? 83? Linux

Command (m for help): t

dd if=/dev/sda of=/dev/sdc? ? bs=512? ? count=10240

? ?? 來(lái)源? ? ? 生成文件系統(tǒng)?? block大小 ?

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末写半,一起剝皮案震驚了整個(gè)濱河市岸蜗,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌叠蝇,老刑警劉巖散吵,帶你破解...
    沈念sama閱讀 219,539評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異蟆肆,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)晦款,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,594評(píng)論 3 396
  • 文/潘曉璐 我一進(jìn)店門炎功,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人缓溅,你說(shuō)我怎么就攤上這事蛇损。” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 165,871評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵淤齐,是天一觀的道長(zhǎng)股囊。 經(jīng)常有香客問(wèn)我,道長(zhǎng)更啄,這世上最難降的妖魔是什么稚疹? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,963評(píng)論 1 295
  • 正文 為了忘掉前任,我火速辦了婚禮祭务,結(jié)果婚禮上内狗,老公的妹妹穿的比我還像新娘。我一直安慰自己义锥,他們只是感情好柳沙,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,984評(píng)論 6 393
  • 文/花漫 我一把揭開(kāi)白布。 她就那樣靜靜地躺著拌倍,像睡著了一般赂鲤。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上柱恤,一...
    開(kāi)封第一講書(shū)人閱讀 51,763評(píng)論 1 307
  • 那天数初,我揣著相機(jī)與錄音,去河邊找鬼膨更。 笑死妙真,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的荚守。 我是一名探鬼主播珍德,決...
    沈念sama閱讀 40,468評(píng)論 3 420
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼矗漾!你這毒婦竟也來(lái)了锈候?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書(shū)人閱讀 39,357評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤敞贡,失蹤者是張志新(化名)和其女友劉穎泵琳,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體誊役,經(jīng)...
    沈念sama閱讀 45,850評(píng)論 1 317
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡获列,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,002評(píng)論 3 338
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了蛔垢。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片击孩。...
    茶點(diǎn)故事閱讀 40,144評(píng)論 1 351
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖鹏漆,靈堂內(nèi)的尸體忽然破棺而出巩梢,到底是詐尸還是另有隱情创泄,我是刑警寧澤,帶...
    沈念sama閱讀 35,823評(píng)論 5 346
  • 正文 年R本政府宣布括蝠,位于F島的核電站鞠抑,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏忌警。R本人自食惡果不足惜搁拙,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,483評(píng)論 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望慨蓝。 院中可真熱鬧感混,春花似錦、人聲如沸礼烈。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 32,026評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)此熬。三九已至庭呜,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間犀忱,已是汗流浹背募谎。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,150評(píng)論 1 272
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留阴汇,地道東北人数冬。 一個(gè)月前我還...
    沈念sama閱讀 48,415評(píng)論 3 373
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像搀庶,于是被迫代替她去往敵國(guó)和親拐纱。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,092評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容

  • 老男孩Linux運(yùn)維58期課堂筆記 ...
    樂(lè)園_YD閱讀 460評(píng)論 0 0
  • [root@oldboyedu ~]# parted /dev/sdb #交互式開(kāi)始分區(qū) GNU Parted ...
    不知道就閱讀 469評(píng)論 0 0
  • 1哥倔、fdisk 分區(qū)工具介紹 1.linux下最常用的分區(qū)工具秸架,一般是裝完系統(tǒng)后進(jìn)行分區(qū)。 2.多數(shù)都是系統(tǒng)ISO...
    子晉zj閱讀 414評(píng)論 0 0
  • 參考文檔 https://www.linuxidc.com/Linux/2017-09/146760.htmhtt...
    三杯水Plus閱讀 4,302評(píng)論 0 8
  • Linux文件系統(tǒng) 1.面試時(shí)如何滿足面試官10大需求咆蒿? 1.1.生理需求:拿出水給面試官喝...
    Aza_Lxxx閱讀 330評(píng)論 0 0