2019-03-29实践课堂笔记

[root@longjie ~]# 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.0157024 s, 334 MB/s

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

-rw-r--r-- 1 root dengli 5242880 Mar 29 17:01 /dev/sdc

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

/dev/sdc: x86 boot sector; partition 1: ID=0x83, active, starthead 32, startsector 204 4096000 sectors; partition 2: ID=0x8e, starthead 23, startsector 4098048, 37844992 seors, code offset 0x63

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

major minor  #blocks  name

  8        0  20971520 sda

  8        1    2048000 sda1

  8        2  18922496 sda2

  8      16    1048576 sdb

  8      17    102400 sdb1

  8      18    102400 sdb2

  11        0    4365312 sr0

253        0  16871424 dm-0

253        1    2048000 dm-1

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

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

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

[root@longjie ~]# 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): 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: 0x20171c36

  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

。。。。。。。

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

(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) mkpart primary 481 580

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

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      481MB  580MB  98.6MB              primary

(parted) mkpart primary 481 580 l                                       

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?

parted: invalid token: l                                                 

Yes/No? Y                                                               

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

Ignore/Cancel? I                                                         

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

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

2      481MB  481MB  512B                primary

1      481MB  580MB  98.6MB              primary

(parted) mkpart logic 581 600

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

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

2      481MB  481MB  512B                primary

1      481MB  580MB  98.6MB              primary

3      581MB  600MB  18.9MB              logic

(parted) help

(parted) w                                                               

  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 NUMBE

  unit UNIT                                set the default unit to UNIT

  version                                  display the version number and copyright

        information of GNU Parted

(parted) w                                                               

  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 NUMBE

  unit UNIT                                set the default unit to UNIT

  version                                  display the version number and copyright

        information of GNU Parted

(parted)                                                                 

(parted) w                                                               

  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 NUMBE

  unit UNIT                                set the default unit to UNIT

  version                                  display the version number and copyright

        information of GNU Parted

(parted) w                                                               

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

  

(parted) w                                                               

PE              create a new disklabel (partition table)


(parted) w                                                               

  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 NUMBE

  unit UNIT                                set the default unit to UNIT

  version                                  display the version number and copyright

        information of GNU Parted

(parted) w                                                               

  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 NUMBE

  unit UNIT                                set the default unit to UNIT

  version                                  display the version number and copyright

        information of GNU Parted

(parted) w                                                               

  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 NUMBE

  unit UNIT                                set the default unit to UNIT

  version                                  display the version number and copyright

        information of GNU Parted

(parted) w                                                               

  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 NUMBE

  unit UNIT                                set the default unit to UNIT

  version                                  display the version number and copyright

        information of GNU Parted

(parted) w                                                               

        information of GNU Parted

(parted) w                                                           

(parted) q                                                               

Information: You may need to update /etc/fstab.

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

GNU Parted 3.1

Using /dev/sdb

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

(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

2      481MB  481MB  512B                primary

1      481MB  580MB  98.6MB              primary

3      581MB  600MB  18.9MB              logic

(parted) mklabel gpt                                                     

Warning: Partition(s) on /dev/sdb are being used.

Ignore/Cancel? I

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this di

will be lost. Do you want to continue?

Yes/No? Y                                                               

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

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

(parted) mkpart primary 0 480

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

Ignore/Cancel? i                                                         

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

Ignore/Cancel? i                                                         

(parted) mkpart primary 481 580                                         

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

Ignore/Cancel? i                                                         

(parted) mkpart logic 581 600                                           

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

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

2      481MB  580MB  98.6MB              primary

3      581MB  600MB  18.9MB              logic

(parted) rm 4                                                           

Error: Partition doesn't exist.

(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

2      481MB  580MB  98.6MB              primary

3      581MB  600MB  18.9MB              logic

(parted)                                                                 

(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

2      481MB  580MB  98.6MB              primary

3      581MB  600MB  18.9MB              logic

(parted) q

Information: You may need to update /etc/fstab.

[root@longjie ~]# 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 NUMBE

  unit UNIT                                set the default unit to UNIT

  version                                  display the version number and copyright

        information of GNU Parted

(parted) mklabel gpt                                                     

Warning: Partition(s) on /dev/sdb are being used.

Ignore/Cancel? I                                                         

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this di

will be lost. Do you want to continue?

Yes/No? Y                                                               

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

Ignore/Cancel? I                                                         

(parted)                                                                 

(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) mkpart primary 0 480                                           

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

Ignore/Cancel? i                                                         

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

Ignore/Cancel? i                                                         

(parted) mkpart primary 481 580                                         

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

Ignore/Cancel? 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? Y                                                               

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

Ignore/Cancel? I

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

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                                           

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

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

4      581MB  600MB  18.9MB              logic

(parted) rm 4                                                           

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

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) mklabel msdos

Warning: Partition(s) on /dev/sdb are being used.

Ignore/Cancel? i                                                         

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this di

will be lost. Do you want to continue?

Yes/No? y                                                               

Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform

the kernel of the change, probably because it/they are in use.  As a result, the old

partition(s) will remain in use.  You should reboot now before making further changes.

Ignore/Cancel? i                                                         

(parted) p                                                               

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 1074MB

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

Partition Table: msdos

Disk Flags:

Number  Start  End  Size  Type  File system  Flags

(parted) q

Information: You may need to update /etc/fstab.

[root@longjie ~]# 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: 0x000c641e

  Device Boot      Start        End      Blocks  Id  System

/dev/sdb1            2048      206847      102400  83  Linux

Command (m for help): o

Building a new DOS disklabel with disk identifier 0x410e00b5.

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: 0x410e00b5

  Device Boot      Start        End      Blocks  Id  System

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: 0x410e00b5

  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):

Using default response 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: 0x410e00b5

  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.

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@longjie ~]# ls -l /dev/sdb*

brw-rw---- 1 root disk 8, 16 Mar 29 19:15 /dev/sdb

brw-rw---- 1 root disk 8, 17 Mar 29 19:15 /dev/sdb1

[root@longjie ~]# mkfs -t ext4 /dev/sdb1

mke2fs 1.42.9 (28-Dec-2013)

/dev/sdb1 is mounted; will not make a filesystem here!

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

mount: /dev/sdb1 is already mounted or /mnt busy

      /dev/sdb1 is already mounted on /mnt

[root@longjie ~]# df -h

[root@longjie ~]# touch /mnt/dengli

[root@longjie ~]# ls /mnt

dengli  lost+found

[root@longjie ~]# cd /mnt

[root@longjie /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@longjie /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@longjie /mnt]# pwd

/mnt

[root@longjie /mnt]# umount -lf /mnt

[root@longjie /mnt]# df -h


[root@longjie /mnt]# cd

[root@longjie ~]# mount /dev/sdb2/opt

mount: can't find /dev/sdb2/opt in /etc/fstab

[root@longjie ~]# mount /dev/sdb1/opt

mount: can't find /dev/sdb1/opt in /etc/fstab

[root@longjie ~]# mkfs.xfs /dev/sdb2

/dev/sdb2: No such file or directory


[root@longjie ~]# mount -t xfs /dev/sdb1 /opt

o

[root@longjie /opt]# cd

[root@longjie ~]# cd /mnt

[root@longjie /mnt]# ls

[root@longjie /mnt]# df -h

m


[root@longjie ~]# mount /dev/sdb2 /opt


[root@longjie ~]# cd /opt

[root@longjie /opt]# df -h



[root@longjie /opt]# cd

[root@longjie ~]# touch /opt/lili

[root@longjie ~]# ls /opt

lili

[root@longjie ~]# cat /ect/fstab

[root@longjie ~]# blkid


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

/dev/mapper/centos-swap swap                    swap    defaults        0 0

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

-bash: /sbin/mount: No such file or directory

[root@longjie ~]# /sbin/mount -t xfs /dev/sdb1/opt


[root@longjie ~]# df -h



"/etc/rc.local" 13L, 507C written                                 

[root@longjie ~]# df -h



[root@longjie ~]# df -i


[root@longjie ~]# blkid

/dev/sda1: UUID="c599f129-ac55-4795-88cf-79800447c570" TYPE="xfs"


[root@longjie ~]# dumpe2fs /dev/sdb1

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



[root@longjie ~]# xfs

-bash: xfs: command not found

[root@longjie ~]# xfs_

-bash: xfs_: command not found

[root@longjie ~]# xfs_


[root@longjie ~]# xfs_


[root@longjie ~]# fsck

fsck from util-linux 2.23.2

[root@longjie ~]# reboot

Connection closing...Socket close.

Connection closed by foreign host.

Disconnected from remote host(10.0.0.200:22) at 19:49:28.

Type `help' to learn how to use Xshell prompt.

[D:\~]$ ssh root@10.0.0.200

Connecting to 10.0.0.200:22...

[root@longjie ~]# df -h


[root@longjie ~]# vim /etc/rc.local

#

# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure

# that this script will be executed during boot.

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

touch /var/lock/subsys/local


/dev/mapper/centos-root /                      xfs    defaults        0 0

UUID=c599f129-ac55-4795-88cf-79800447c570 /boot                  xfs    defaults

    0 0

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

/dev/mapper/centos-swap swap                    swap    defaults        0 0


"/etc/fstab" 13L, 500C written                                   

[root@longjie ~]# reboot


[D:\~]$ ssh root@10.0.0.200


[root@longjie ~]# cat /etc/rc.local

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

touch /var/lock/subsys/local

[root@longjie ~]# df -h

Filesystem              Size  Used Avail Use% Mounted on


[root@longjie ~]# vim /etc/rc.local

#!/bin/bash

# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES


~                                                                                   


"/etc/rc.local" 13L, 474C written                                 

[root@longjie ~]# vim /etc/fstab


"/etc/fstab" 13L, 544C written                                   

[root@longjie ~]# reboot

Connection closing...Socket close.

Connection closed by foreign host.

Disconnected from remote host(10.0.0.200:22) at 20:11:12.

Type `help' to learn how to use Xshell prompt.

[D:\~]$ ssh root@10.0.0.200

Connecting to 10.0.0.200:22...

Connection established.

To escape to local shell, press 'Ctrl+Alt+]'.

WARNING! The remote SSH server rejected X11 forwarding request.

Last login: Fri Mar 29 20:08:08 2019 from 10.0.0.1

-bash: /etc/bashrc: Permission denied

[root@longjie ~]# df -s

df: invalid option -- 's'

Try 'df --help' for more information.

[root@longjie ~]# df -h

Filesystem              Size  Used Avail Use% Mounted on

/dev/mapper/centos-root  17G  1.6G  15G  10% /

devtmpfs                899M    0  899M  0% /dev

tmpfs                    911M    0  911M  0% /dev/shm

tmpfs                    911M  9.6M  902M  2% /run

tmpfs                    911M    0  911M  0% /sys/fs/cgroup

/dev/sdb2                97M  5.2M  92M  6% /opt

/dev/sda1                2.0G  143M  1.9G  8% /boot

tmpfs                    183M    0  183M  0% /run/user/0

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 216,496评论 6 501
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,407评论 3 392
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 162,632评论 0 353
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,180评论 1 292
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,198评论 6 388
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,165评论 1 299
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,052评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,910评论 0 274
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,324评论 1 310
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,542评论 2 332
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,711评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,424评论 5 343
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,017评论 3 326
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,668评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,823评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,722评论 2 368
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,611评论 2 353

推荐阅读更多精彩内容