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部分命令及通配符用法

    pwd: 显示工作目录 cd -: 在上一次所在目录与当前目录之间来回切换 cd: 切换回家目录 cat:  文本查看工具 n:给显示的文本行编号 -E:显示行结束符$ passwd 修改用户的密码 which 查看系统命令所对应的路径 df 查看系统分区 runlevel 查看系统运行级别  (共有6个级别) Tty…

    2017-03-28
  • 初涉Linux基本要点概括(1)

    计算机,这里通常指可以储存程序的计算机,根据冯诺依曼体系,计算机组成部件包括控制单元(Control Unit)、算术逻辑单元(Arithmetic Logic Unit)、内存(Memory)、输入设备(Input)、输出设备(Output)。计算机通过输入的数据和指令,可以完成各种复杂的运算任务,小到文字处理、游戏、影音、大到卫星定位,火箭发射,人工智能…

    Linux干货 2016-09-26
  • 脚本函数与程序包管理

    一、函数调用 1.while循环的特殊用法(遍历文件的每一行): while read line; do    循环体done < /PATH/FROM/SOMEFILE 依次读取/PATH/FROM/SOMEFILE文件中的每一行,且将行赋值给变量line示例:扫描/etc/passwd文件每一行,如发现GECOS字段为…

    Linux干货 2016-08-21
  • Linux软件包管理

      在我们的运维工作,总是避免不了安装某些软件,或者编译安装某些软件,我们知道操作系统当中的程序都是有程序员通过开发工具开发的来,程序员直接编写的纯文本的文档我们称之为源代码,但我们的计算机只能识别二进制程序,那么必须要将源代码变成计算机能识别的二进制程序,这里需要通过编译器来进行编译,将源码转换成二进制程序,再通过安装即可。 还有一类程序就是二进…

    Linux干货 2016-08-24
  • ​redis cluster 安装指南

    公司的很多项目在使用redis主从。由于coder的各种毁灭性操作,迫切需要一个能带故障恢复的架构。因此新版的cluster,开始了测试。 一、Cluster 理论基础 Cluster介绍 Redis集群是一个提供在多个Redis间节点间共享数据的程序集。 Redis集群并不支持处理多个keys的命令,因为这需要在不同的节点间移动数据,从而达不到像Redis…

    Linux干货 2016-02-14
  • 计算机运维基础知识 Linux版

    计算机系统由硬件系统和软件系统组成 第一代计算机   电子管时代 第二代计算机   晶体管时代 第三代计算机   集成电路时代 第四代计算机   大规模集成电路时代 1964年,世界第一代计算机ENICA。用来计算弹道轨迹。 冯诺依曼  计算机之父 运算器,控制器,存储器,输入设备,输出设备。 巨型计算机,大…

    Linux干货 2016-08-04

评论列表(1条)

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

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