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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容