user and group quota SWAP fstab file and parted command part 2

parted
select /dev/sdb
mklabel msdos
mkpart primary 1  10GB       # here partition starts from 1  that's  1 MB
quit

mkfs.ext4 -j  /dev/sdb1
OR
mke2fs -t ext4 -j /dev/sdb1

-j = journaling is an option as provided for transaction oriented processing of writes to disk in event of posssible corruption introduced by abrupt power outages

usermod -a -G admins  urgen
mount -o remount,rw /

use blkid to ascertain UUID of recently created partion for /etc/fstab
#blkid
UUID="9b317d2e-f873-4f1e-a12c-0a57e54c5657" /projectx ext4 defaults 0  0


when mounted roughly about 2% is used to manage journaling the file system

= = = = = = = = = =USER QUOTA = = = = = = =
yum install quota*
vim  fstab

uuid="sdklfjdskljf"  /home ext4 defaults,usrquota,grpquota 0  0

mount  -o  remount,rw   /drive
  quotacheck -cug   /drive/
  quotacheck -mcug  /home  ##this will create q.check db and generate disk usage table
                                            ##use -m option to overwrite the need of single user mode
  quotaon /drive
edquota urgen
Disk quotas for user urgen (uid 501):
  Filesystem                blocks       soft        hard             inodes     soft     hard
  /dev/sdb1                 90        2000000    2097000          4        0        0
                          [used block] <-- [around 2GB]-->
  repquota -a

Note:quotacheck should be run in SINGLE user mode when system reboots
quotacheck should be run in SINGLE user mode when system reboots
use:
m = dont remount filesystem read-only
a = (all)check all filesystems
= check group files
= check user files
c = create new quota files
quotacheck -mcug  /home  ##this will create quota check db and generate disk usage table

quotacheck -avug   #checks quotas
quotacheck -mavug   #force check quota or update quota data

edquota username

quota username
repquota  /drive  #report quota for all user

 = = = =  = = = =  = = = = = GROUP QUOTA = = = = = = = = = = = = = =
#quotaon /drive
[root@demo1 drive]# edquota -g urgen

Disk quotas for group urgen (gid 501):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/sdb1                     11000      10000      11000          6        5        0

Make sure of the group owner ship of filecreated
-------------------------------------------------

# quota -g urgen     ##check quota usage for group urgen



Do not attempt to resize a partition on a device that is in use.
Before resizing a partition, boot into rescue mode (or unmount any partitions on the device and turn off any swap space on the device).
Start parted, where /dev/sda is the device on which to resize the partition:
parted /dev/sda       
View the current partition table to determine the minor number of the partition to resize as well as the start and end points for the partition:
print
To resize the partition, use the resize command followed by the minor number for the partition, the starting place in megabytes, and the end place in megabytes. For example:
resize 3 1024 2048

= = = = = = = = =SWAP Space = = = = = = = = =
TRY TO MAKE SWAP PARTITIN ON A DEDICATED PARTITION OR DRIVE
check Swap with  top | free -m | swapon -s
 [root@monitor1 ~]# parted /dev/sdb
GNU Parted 2.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: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  10.2GB  10.2GB  primary  ext4
(parted) help mkpart                                                                                    #displays help for mkpart
(parted) mkpart  primary   linux-swap  10.2GB   11.2GB                          ##add 1 GB swap
(parted)print
Number  Start   End     Size    Type     File system  Flags
 1      1049kB  10.2GB  10.2GB  primary  ext4
 2      10.2GB  11.2GB  959MB   primary
# we might not see filesystem type here in parted ,we check with fdisk -l /dev/sdb command

# mkswap /dev/sdb2
vim /etc/fstab
UUID=05bb80f0-2c4e-46d8-98bf-2f7d8cbf8a8f none swap defaults 0 0
swapon -s   ##check your current unchanged swap
swapon -a   ## reload fstab with changed swap

swapoff -a  ##disables swap

++++++++++SWAP File+++++++++++++++++
dd  if=/dev/zero  of=/swapdir/swapfile3GB   bs=1024   count=3145728
mkswap   /swapdir/swapfile3GB
vim /etc/fstab
/swapdir /swapfile3GB  none swap defaults 0 0
OR
/swapdir /swapfile3GB  none swap sw 0 0

swapon -a



No comments:

Post a Comment