NET25-第7周作业

1、创建一个10G分区,并格式为ext4文件系统; (1) 要求其block大小为2048, 预留空间百分比为2, 卷标为MYDATA, 默认挂载属性包含acl;

[root@node1 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x35f2524b.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1566, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1566, default 1566): +10G

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

[root@node1 ~]# fdisk -l

Disk /dev/sda: 68.7 GB, 68719476736 bytes
255 heads, 63 sectors/track, 8354 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00080118

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        8355    66595840   8e  Linux LVM

Disk /dev/sdb: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x35f2524b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1306    10490412+  83  Linux
Partition 1 does not start on physical sector boundary.

[root@node1 ~]# mke2fs -t ext4 -b 2048 -L MYDATA -m 2  /dev/sdb1

Warning: specified blocksize 2048 is less than device physical sectorsize 4096
/dev/sdb1 alignment is offset by 512 bytes.
This may result in very poor performance, (re)-partitioning suggested.
Discarding device blocks: done                            
Filesystem label=MYDATA
OS type: Linux
Block size=2048 (log=1)
Fragment size=2048 (log=1)
Stride=2 blocks, Stripe width=0 blocks
657408 inodes, 5245206 blocks
104904 blocks (2.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=543162368
321 block groups
16384 blocks per group, 16384 fragments per group
2048 inodes per group
Superblock backups stored on blocks: 
        16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816, 1327104, 
        2048000, 3981312

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@node1 ~]# tune2fs -o acl /dev/sdb1
tune2fs 1.41.12 (17-May-2010)
[root@node1 ~]# tune2fs -l /dev/sdb1
tune2fs 1.41.12 (17-May-2010)
Filesystem volume name:   MYDATA
Last mounted on:          <not available>
Filesystem UUID:          d34ccee5-41dc-41be-b81d-09de4cf406f8
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    acl
Filesystem state:         clean
...

(2) 挂载至/data/mydata目录,要求挂载时禁止程序自动运行,且不更新文件的访问时间戳;

[root@node1 ~]# mkdir /mydata
[root@node1 ~]# vim /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Thu Jan 26 08:57:47 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_node1-lv_root /                       ext4    defaults        1 1
UUID=b41284cf-58ea-42af-a9dc-6d4d3b39e6bd /boot                   ext4    defaults        1 2
/dev/mapper/vg_node1-lv_home /home                   ext4    defaults        1 2
/dev/mapper/vg_node1-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/sdb1               /mydata                 ext4     defaults 0 0
[root@node1 ~]# mount -a
[root@node1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_node1-lv_root
                       50G  2.1G   45G   5% /
tmpfs                 497M     0  497M   0% /dev/shm
/dev/sda1             477M   28M  425M   7% /boot
/dev/mapper/vg_node1-lv_home
                       12G   29M   11G   1% /home
/dev/sdb1             9.8G   13M  9.6G   1% /mydata

2、创建一个大小为1G的swap分区,并创建好文件系统,并启用之;

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

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1306-1566, default 1306): 
Using default value 1306
Last cylinder, +cylinders or +size{K,M,G} (1306-1566, default 1566): +1G                   

Command (m for help): l

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris        
 1  FAT12           39  Plan 9          82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      3c  PartitionMagic  83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       40  Venix 80286     84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      41  PPC PReP Boot   85  Linux extended  c7  Syrinx         
 5  Extended        42  SFS             86  NTFS volume set da  Non-FS data    
 6  FAT16           4d  QNX4.x          87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS       4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility   
 8  AIX             4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt         
 9  AIX bootable    50  OnTrack DM      93  Amoeba          e1  DOS access     
 a  OS/2 Boot Manag 51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O        
 b  W95 FAT32       52  CP/M            9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs        
 e  W95 FAT16 (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  GPT            
 f  W95 Ext'd (LBA) 55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor      
12  Compaq diagnost 61  SpeedStor       a9  NetBSD          f4  SpeedStor      
14  Hidden FAT16 <3 63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary  
16  Hidden FAT16    64  Novell Netware  af  HFS / HFS+      fb  VMware VMFS    
17  Hidden HPFS/NTF 65  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE 
18  AST SmartSleep  70  DiskSecure Mult b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 75  PC/IX           bb  Boot Wizard hid fe  LANstep        
1c  Hidden W95 FAT3 80  Old Minix       be  Solaris boot    ff  BBT            
1e  Hidden W95 FAT1

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap / Solaris)

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@node1 ~]# partx -a /dev/sdb
BLKPG: Device or resource busy
error adding partition 1
BLKPG: Device or resource busy
error adding partition 2
[root@node1 ~]# cat /proc/partitions 
major minor  #blocks  name

   8        0   67108864 sda
   8        1     512000 sda1
   8        2   66595840 sda2
   8       16   12582912 sdb
   8       17   10490412 sdb1
   8       18    1052260 sdb2
 253        0   52428800 dm-0
 253        1    2064384 dm-1
 253        2   12099584 dm-2
 [root@node1 ~]# mkswap /dev/sdb2
Setting up swapspace version 1, size = 1052256 KiB
no label, UUID=9a337afc-207f-4568-99a4-812d263fd223
[root@node1 ~]# swapon /dev/sdb2
[root@node1 ~]# free -g
             total       used       free     shared    buffers     cached
Mem:             0          0          0          0          0          0
-/+ buffers/cache:          0          0
Swap:            2          0          2
[root@node1 ~]# cat /proc/swaps 
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       2064380 0       -1
/dev/sdb2                               partition       1052256 0       -2

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

#
# /etc/fstab
# Created by anaconda on Thu Jan 26 08:57:47 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_node1-lv_root /                       ext4    defaults        1 1
UUID=b41284cf-58ea-42af-a9dc-6d4d3b39e6bd /boot                   ext4    defaults        1 2
/dev/mapper/vg_node1-lv_home /home                   ext4    defaults        1 2
/dev/mapper/vg_node1-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/sdb1               /mydata                 ext4     defaults 0 0
/dev/sdb2                swap                   swap     defaults  0 0
[root@node1 ~]# mount -a

3、写一个脚本

(1)、获取并列出当前系统上的所有磁盘设备;

#!/bin/bash
for dev in $(fdisk -l | grep "Disk /" | awk '{print $2}' | tr -d ':')
do
echo ${dev}
done

(2)、显示每个磁盘设备上每个分区相关的空间使用信息;

for par in $(disk -l | grep ^/dev | awk  '{print $1}')
do
echo ${par}
df -HT ${par}
done

4、总结RAID的各个级别及其组合方式和性能的不同;

RAID详解

5、创建一个大小为10G的RAID1,要求有一个空闲盘,而且CHUNK大小为128k;

先创建310g的分区sda1,sda2,sda3
[root@node1 ~]#mdadm -C /dev/md1 -l 1 -n 3 -c 128 -x 1 /dev/sda{1,2,3}
[root@node1 ~]#mdadm -D /dev/md1

6、创建一个大小为4G的RAID5设备,chunk大小为256k,格式化ext4文件系统,要求可开机自动挂载至/backup目录,而且不更新访问时间戳,且支持acl功能;

先创建34g的分区sdb1,sdb2,sdb3
[root@node1 ~]#mdadm -C /dev/md2 -l 5 -c 256 -n 3 /dev/sdb{1,2,3}
[root@node1 ~]#mke2fs -t ext4 /dev/md1
[root@node1 ~]#vim /etc/fsatb
[root@node1 ~]# vim /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Thu Jan 26 08:57:47 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_node1-lv_root /                       ext4    defaults        1 1
UUID=b41284cf-58ea-42af-a9dc-6d4d3b39e6bd /boot                   ext4    defaults        1 2
/dev/mapper/vg_node1-lv_home /home                   ext4    defaults        1 2
/dev/mapper/vg_node1-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/sdb1               /mydata                 ext4     defaults 0 0
/dev/sdb2                swap                   swap     defaults  0 0
UUID='cbe43ac9-28be-4656-93e1-07bf03c72d14'
                 /backup   ext4    defaults,acl,noatime   0 0

7、写一个脚本

  • (1) 接受一个以上文件路径作为参数;
  • (2) 显示每个文件拥有的行数;
  • (3) 总结说明本次共为几个文件统计了其行数;
#!/bin/bash
declare -i file_num line_num
file_num=0
line_num=0
if [ $# -eq 0 ];then
    echo 'no parm...'
    exit
fi
for file in $@;do
    if [ -f $file ];then
        line=$(cat $file |wc -l)
        echo "$file total line $line "
        let file_num++
        let line_num+=$line
    else
        continue
    fi
done

echo "All file number is $file_num"
echo "All line number is $line_num"

8、写一个脚本

  • (1) 传递两个以上字符串当作用户名;
  • (2) 创建这些用户;且密码同用户名;
  • (3) 总结说明共创建了几个用户;
#!/bin/bash
if [ $# -lt 2 ];then
    echo "User at least two"
    exit
fi
for user in $@;do
    useradd ${user}
    echo ${user} | passwd --stdin ${user}
    let num++
done
echo "total create $num users"

9、写一个脚本,新建20个用户,visitor1-visitor20;计算他们的ID之和;

#!/bin/bash
for i in `seq 20`;do
    useradd visitor${i}
    num=`id -u visitor${i}`
    let num_total+=$num
done
echo "visitor1-visitor20 uid total ${num_total}"

10、写一脚本,分别统计/etc/rc.d/rc.sysinit、/etc/init.d/function和/etc/fstab文件中以#号开头的行数之和,以及总的空白行数;

#!/bin/bash
check_space() {
for file in $@;do
    if [ -f $file ];then
        space_line=$(cat $file | grep -c "^$")
        echo "$file space line is $space_line"
    else
        echo -n -e "no file\nexit\n"
        exit
    fi
done
}
check_head() {
for file in $@;do
    if [ -f $file ];then
        head_line=$(cat $file | grep -c "^#")
        echo "$file '#' head line is $head_line"
    else
        echo -n -e "no file\nexit\n"
        exit
    fi
done
}
check_space /etc/rc.d/rc.sysinit /etc/init.d/function /etc/fstab
check_head /etc/rc.d/rc.sysinit /etc/init.d/function /etc/fstab

11、写一个脚本,显示当前系统上所有默认shell为bash的用户的用户名、UID以及此类所有用户的UID之和;

#!/bin/bash
cat /etc/passwd |grep "/bin/bash"| awk -F ":" '{print $1,$3}'
uids=`cat /etc/passwd |grep "/bin/bash"| awk -F ":" '{print $3}'`
for uid in $uids;do
   let  total+=$uid
done
echo "all shell is '/bin/bash' uid total is $total"

12、写一个脚本,显示当前系统上所有,拥有附加组的用户的用户名;并说明共有多少个此类用户;

#!/bin/bash
users=`cat /etc/passwd | awk -F ':' '{print $1}'`
for user in $users;do
    if [ `groups $user | awk -F ':' '{print $2 }' | wc -w` -gt 1 ];then
        echo $user
        let line++
    else
        continue
    fi
done

echo "total $line"

13、创建一个由至少两个物理卷组成的大小为20G的卷组;要求,PE大小为8M;而在卷组中创建一个大小为5G的逻辑卷mylv1,格式化为ext4文件系统,开机自动挂载至/users目录,支持acl;

[root@node1 ~]# pvcreate /dev/sdb1 /dev/sdb2 
  Physical volume "/dev/sdb1" successfully created
  Physical volume "/dev/sdb2" successfully created
[root@node1 ~]# vgcreate -s 8M myvg1 /dev/sdb{1,2}
  Volume group "myvg1" successfully created
[root@node1 ~]# lvcreate -n mylv1 -L 5g myvg1
  Logical volume "mylv1" created.
[root@node1 ~]# mke2fs -t ext4 /dev/myvg1/mylv1 
mke2fs 1.41.12 (17-May-2010)
Discarding device blocks: done                            
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=1 blocks, Stripe width=0 blocks
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@node1 ~]# vim /etc/fstab 
/dev/sdb2                swap                   swap     defaults  0 0
/dev/sdb1               /mydata                 ext4     defaults 0 0

#
# /etc/fstab
# Created by anaconda on Thu Jan 26 08:57:47 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_node1-lv_root /                       ext4    defaults        1 1
UUID=b41284cf-58ea-42af-a9dc-6d4d3b39e6bd /boot                   ext4    defaults        1 2
/dev/mapper/vg_node1-lv_home /home                   ext4    defaults        1 2
/dev/mapper/vg_node1-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/myvg1/mylv1        /users                  ext4     defaults,acl  0 0

14、新建用户magedu;其家目录为/users/magedu,而后su切换至此用户,复制多个文件至家目录;

[root@node1 ~]# useradd -d /users/magedu magedu
[root@node1 ~]# su - magedu
[magedu@node1 ~]$ pwd
/users/magedu
[magedu@node1 ~]$ ls -a
.  ..  .bash_logout  .bash_profile  .bashrc

15、扩展mylv1至9G,确保扩展完成后原有数据完全可用;

[root@node1 ~]# lvextend -L 9g /dev/myvg1/mylv1
  Size of logical volume myvg1/mylv1 changed from 5.00 GiB (640 extents) to 9.00 GiB (1152 extents).
  Logical volume mylv1 successfully resized.
[root@node1 ~]# lvs
  LV      VG       Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  mylv1   myvg1    -wi-ao----  9.00g                                                    
  lv_home vg_node1 -wi-ao---- 11.54g                                                    
  lv_root vg_node1 -wi-ao---- 50.00g                                                    
  lv_swap vg_node1 -wi-ao----  1.97g                                                    
[root@node1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_node1-lv_root
                       50G  2.1G   45G   5% /
tmpfs                 497M     0  497M   0% /dev/shm
/dev/sda1             477M   28M  425M   7% /boot
/dev/mapper/vg_node1-lv_home
                       12G   30M   11G   1% /home
/dev/mapper/myvg1-mylv1
                      4.8G   11M  4.6G   1% /users
[root@node1 ~]# resize2fs /dev/myvg1/mylv1 9G
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/myvg1/mylv1 is mounted on /users; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/myvg1/mylv1 to 2359296 (4k) blocks.
The filesystem on /dev/myvg1/mylv1 is now 2359296 blocks long.

[root@node1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_node1-lv_root
                       50G  2.1G   45G   5% /
tmpfs                 497M     0  497M   0% /dev/shm
/dev/sda1             477M   28M  425M   7% /boot
/dev/mapper/vg_node1-lv_home
                       12G   30M   11G   1% /home
/dev/mapper/myvg1-mylv1
                      8.8G   12M  8.3G   1% /users

16、缩减mylv1至7G,确保缩减完成后原有数据完全可用;

[root@node1 ~]# umount /users/
[root@node1 ~]# e2fsck /dev/myvg1/mylv1 
e2fsck 1.41.12 (17-May-2010)
/dev/myvg1/mylv1: clean, 16/589824 files, 72676/2359296 blocks
[root@node1 ~]# resize2fs /dev/myvg1/mylv1 7G
resize2fs 1.41.12 (17-May-2010)
Please run 'e2fsck -f /dev/myvg1/mylv1' first.

[root@node1 ~]# e2fsck -f /dev/myvg1/mylv1
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/myvg1/mylv1: 16/589824 files (0.0% non-contiguous), 72676/2359296 blocks
[root@node1 ~]# resize2fs /dev/myvg1/mylv1 7G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/myvg1/mylv1 to 1835008 (4k) blocks.
The filesystem on /dev/myvg1/mylv1 is now 1835008 blocks long.

[root@node1 ~]# lvreduce -L 7g /dev/myvg1/mylv1 
  WARNING: Reducing active logical volume to 7.00 GiB.
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce myvg1/mylv1? [y/n]: y
  Size of logical volume myvg1/mylv1 changed from 9.00 GiB (1152 extents) to 7.00 GiB (896 extents).
  Logical volume mylv1 successfully resized.
[root@node1 ~]# mount -a
[root@node1 ~]# su - magedu
[magedu@node1 ~]$ ls -a
.  ..  .bash_history  .bash_logout  .bash_profile  .bashrc
[magedu@node1 ~]$ cat .bash_history 
pwd
ls
ls -a
cd ..
cd
lvextend -L 9g /dev/myvg1/mylv1 
exit
[magedu@node1 ~]$

17、对mylv1创建快照,并通过备份数据;要求保留原有的属主属组等信息;"

[root@node1 ~]# lvcreate -L 3g -n mylv1_snp -s -p r /dev/myvg1/mylv1 
  Logical volume "mylv1_snp" created.
[root@node1 ~]# mkdir /snop
[root@node1 ~]# mount /dev/myvg1/mylv1_snp /snop/
mount: block device /dev/mapper/myvg1-mylv1_snp is write-protected, mounting read-only
[root@node1 ~]# cd /snop/
[root@node1 snop]# ls
lost+found  magedu
[root@node1 snop]# cd magedu/
[root@node1 magedu]# ls
[root@node1 magedu]# ls -a
.  ..  .bash_history  .bash_logout  .bash_profile  .bashrc
[root@node1 /]# cd /users/
[root@node1 users]# ls
lost+found  magedu
[root@node1 users]# cd magedu/
[root@node1 magedu]# ls
[root@node1 magedu]# ls -a
.  ..  .bash_history  .bash_logout  .bash_profile  .bashrc
[root@node1 magedu]# rm -rf .bash_history 
[root@node1 magedu]# cd /snop/
[root@node1 snop]# ls -a
.  ..  lost+found  magedu
[root@node1 snop]# cd magedu/
[root@node1 magedu]# ls -a
.  ..  .bash_history  .bash_logout  .bash_profile  .bashrc

原创文章,作者:N25_随心,如若转载,请注明出处:http://www.178linux.com/69452

(0)
N25_随心N25_随心
上一篇 2017-03-15
下一篇 2017-03-15

相关推荐

  • Linux发行版之间的联系与区别及其哲学思想。

    一、Linux发行版之间的联系与区别。 随着Linux不断发展,Linux所支持的文件系统类型也在迅速扩充。很多的数据中心服务器上都运行着Linux,可以节省大量的许可证费用及维护费用。但伴随着Linux新版本的发行,其中每一个不同版本的Linux所支持的文件系统类型都有所不同。Linux的发行版有数百种之多。 1、Debian:是指一个致力于创建自由操作系…

    Linux干货 2016-10-30
  • linux基础命令

    显示当前系统正在使用的shell:echo ${SHELL}  注意$在这里表示输出的内容是变量命令提示符:prompt[root@localhost ~]# 表示管理员用户 $表示普通用户修改提示符格式 PS1=“[\e[31m][\u@\h \w]\$[\e[0m]”\h 主机名简称\H 主机名\w 当前…

    Linux干货 2017-04-05
  • SHELL脚本基础速览

    变量的赋值: Shell变量赋值从右到左进进行赋值 格式:NAME=value 变量的声明: export 变量名  export NAME=value declare –x 变量名 declare –x NAME=value   readonly 变量名  特定情况下需要使用到只读变量 readonly NAME=v…

    2017-04-15
  • M20 – 1- 第三周博客(2):Linux用户、组

    一、Linux用户组详解 Linux系统中的每个用户都有一个用户组,系统能对一个用户组中的所有用户进行集中管理。不同Linux系统对用户组的规定有所不同,如Linux下的用户属于和他同名的用户组,这个用户组在创建用户时同时创建。用户组的管理涉及用户组的添加、删除和修改。组的增加、删除和修改实际上就对/etc/group文件的更新。 用户组(group)就是具…

    Linux干货 2016-08-05
  • 脚本练习

      1、写一个脚本,使用ping命令探测10.1.8.1-10.1.8.10之间所有主机的在线状态,在线的主机使用绿色显示,不在线的主机使用红色显示。     #!/bin/bash     #Test host whether onlin…

    Linux干货 2016-12-18
  • MySQL/MariaDB基础性知识及DDL操作详解

    前言 MySQL/MariaDB是一个开放源码的小型关联式数据库管理系统,由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降低网站总体拥有成本而选择了MySQL/MariaDB作为网站数据库。 基础架构 MySQL核心组件 连接池:认证、线程重用、连接数限制、内存检查、缓存 SQL接口:DDL, DML, 关系型数据库的基本抽…

    Linux干货 2015-05-07

评论列表(1条)

  • 马哥教育
    马哥教育 2017-03-29 17:10

    作业完成的非常用心,非常值得其他同学学习,加油,再接再励。