Reference : www.ubuntuscape.com , http://km.phuket.psu.ac.th/

Date : 4 November 2559

[root@pdscatner home]# fdisk /dev/sda
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.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x4979bc22.

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition’s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): p

Disk /dev/sda: 300.0 GB, 299966445568 bytes, 585871964 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: 0x4979bc22

Device Boot Start End Blocks Id System

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition’s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-585871963, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-585871963, default 585871963):
Using default value 585871963
Partition 1 of type Linux and of size 279.4 GiB is set

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition’s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@pdscatner home]# fdisk /dev/sda
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): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition’s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): p

Disk /dev/sda: 300.0 GB, 299966445568 bytes, 585871964 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: 0x4979bc22

Device Boot Start End Blocks Id System
/dev/sda1 2048 585871963 292934958 83 Linux

Command (m for help):q

[root@pdscatner home]# mkfs.ext3 /dev/sda
sda sda1
[root@pdscatner home]# mkfs.ext3 /dev/sda1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
18309120 inodes, 73233739 blocks
3661686 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
2235 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, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616

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

[root@pdscatner home]# cd /
[root@pdscatner /]# mkdir eDATA
[root@pdscatner /]# mount /dev/sda1 eDATA/
[root@pdscatner /]# cd eDATA/
[root@pdscatner eDATA]# mkdir home

[root@pdscatner home]# cat /etc/fstab

#

/etc/fstab

Created by anaconda on Mon Nov 7 14:14:18 2016

#

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/clearos-root                                          /         xfs     defaults 0 0
UUID=1852f4f7-edc4-4f22-bfb6-a8dc184dcbaf /boot xfs     defaults 0 0
/dev/mapper/clearos-swap                                        swap swap defaults 0 0

/dev/sda1 /home                                                                        ext3  defaults 0 0

[root@kitmana ~]# fdisk -l

Disk /dev/sdb: 160.0 GB, 160041885696 bytes, 312581808 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: 0x000795cd

Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 304211967 152104960 83 Linux
/dev/sdb2 304214014 312580095 4183041 5 Extended
/dev/sdb5 304214016 312580095 4183040 82 Linux swap / Solaris

Disk /dev/sda: 120.0 GB, 120034123776 bytes, 234441648 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: 0x0002c628

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 234440703 116707328 8e Linux LVM

Disk /dev/mapper/clearos-root: 115.3 GB, 115297222656 bytes, 225189888 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 /dev/mapper/clearos-swap: 4160 MB, 4160749568 bytes, 8126464 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

[root@pdsnas ~]# parted /dev/sda

(parted) mklabel gpt
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you
want to continue?
Yes/No? yes
Error: Partition(s) 1 on /dev/sda 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) print
Model: ATA ST1000DM003-1CH1 (scsi)
Disk /dev/sda: 1.00TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags

(parted) unit TB
(parted) print
Model: ATA ST1000DM003-1CH1 (scsi)
Disk /dev/sda: 1.00TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags

(parted) mkpart primary 0.00TB 1.00TB
(parted) print
Model: ATA ST1000DM003-1CH1 (scsi)
Disk /dev/sda: 1.00TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 0.00TB 1.00TB 1.00TB primary

(parted) quit
Information: You may need to update /etc/fstab.

[root@pds ~]# reboot

[root@pdsnas ~]# mkfs.ext4 -L eDATA /dev/sda
mke2fs 1.42.9 (28-Dec-2013)
/dev/sda is entire device, not just one partition!
Proceed anyway? (y,n) y
/dev/sda is apparently in use by the system; will not make a filesystem here!

[root@pdsnas ~]# fdisk -l /dev/sda
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: gpt

Start End Size Type Name

1 2048 1953523711 931.5G Microsoft basic primary
[root@pdsnas ~]# mkdir /eDATA
[root@pdsnas ~]# mount /dev/sda /eDATA
mount: /dev/sda is already mounted or /eDATA busy
[root@pdsnas ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/clearos-root 1.9T 10G 1.9T 1% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 4.0K 2.0G 1% /dev/shm
tmpfs 2.0G 17M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sdb1 494M 169M 326M 35% /boot
tmpfs 395M 0 395M 0% /run/user/991
tmpfs 395M 0 395M 0% /run/user/975
tmpfs 395M 0 395M 0% /run/user/0
[root@pdsnas ~]# blkid /dev/sda
/dev/sda: PTTYPE=”gpt”

[root@pdsnas /]# cd eDATA

[root@pdsnas eDATA]# mkdir BACKUP

[root@pdsnas eDATA]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/clearos-root 1.9T 10G 1.9T 1% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 4.0K 2.0G 1% /dev/shm
tmpfs 2.0G 17M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sdb1 494M 169M 326M 35% /boot
tmpfs 395M 0 395M 0% /run/user/991
tmpfs 395M 0 395M 0% /run/user/975
tmpfs 395M 0 395M 0% /run/user/0


[root@pdsnas ~]# fdisk /dev/sda

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.
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):m  { print this menu }

Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition’s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): g   { create a new empty GPT partition table }
Building a new GPT disklabel (GUID: 009C3C15-6B2E-4B04-B30D-85B38C675E91

Disk /dev/sda: 300.0 GB, 299966445568 bytes, 585871964 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: gpt

Start End Size Type Name

1 2048 585871930 279.4G Linux filesyste

Command (m for help): g
Building a new GPT disklabel (GUID: 68B7677A-CA4C-4192-900D-E9EE99233D80)

Command (m for help): n   { add a new partition }
Partition number (1-128, default 1): 1
First sector (2048-1953525134, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-1953525134, default 1953525134):
Created partition 1

Command (m for help): n
Partition number (1-128, default 1): 1
First sector (2048-1953525134, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-1953525134, default 1953525134):
Created partition 1
Command (m for help): m
Command action
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
q quit without saving changes
s create a new empty Sun disklabel
w write table to disk and exit

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@pdscatner network-scripts]# mkfs.ext3 /dev/sda
mke2fs 1.42.9 (28-Dec-2013)
/dev/sda is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
18309120 inodes, 73233995 blocks
3661699 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
2235 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, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616

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

[root@pdscatner network-scripts]# fdisk -l /dev/sda

Disk /dev/sda: 300.0 GB, 299966445568 bytes, 585871964 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

[root@pdscatner /]# mkdir eDATA
[root@pdscatner /]# mount /dev/sda eDATA/
[root@pdscatner /]# ls -ll
total 36
lrwxrwxrwx. 1 root root 7 Nov 1 22:37 bin -> usr/bin
dr-xr-xr-x. 4 root root 4096 Nov 2 03:04 boot
drwxr-xr-x 21 root root 3360 Nov 2 04:14 dev
drwxr-xr-x 3 root root 4096 Nov 2 04:14 eDATA
drwxr-xr-x. 115 root root 8192 Nov 2 03:47 etc
drwxr-xr-x. 2 root root 6 Aug 12 2015 home
lrwxrwxrwx. 1 root root 7 Nov 1 22:37 lib -> usr/lib
lrwxrwxrwx. 1 root root 9 Nov 1 22:37 lib64 -> usr/lib64
drwxr-xr-x. 2 root root 6 Aug 12 2015 media
drwxr-xr-x. 2 root root 6 Aug 12 2015 mnt
drwxr-xr-x. 2 root root 6 Aug 12 2015 opt
dr-xr-xr-x 339 root root 0 Nov 1 23:58 proc
dr-xr-x—. 2 root root 4096 Nov 1 23:23 root
drwxr-xr-x 50 root root 1460 Nov 2 04:04 run
lrwxrwxrwx. 1 root root 8 Nov 1 22:37 sbin -> usr/sbin
drwxr-xr-x. 2 root root 6 Aug 12 2015 srv
drwxr-xr-x. 2 root root 6 Sep 4 2015 store
dr-xr-xr-x 13 root root 0 Nov 1 23:58 sys
drwxrwxrwt. 16 root root 4096 Nov 2 04:19 tmp
drwxr-xr-x. 14 root root 4096 Nov 1 22:37 usr
drwxr-xr-x. 24 root root 4096 Nov 2 02:51 var

[root@pdscatner /]# cat /etc/fstab

#

/etc/fstab

Created by anaconda on Tue Nov 1 22:35:57 2016

#

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/clearos00-root                                                        / xfs                  defaults 0 0
UUID=dc38abda-7b93-4a6a-8cd0-05565ecd8993 /boot       xfs    defaults 0 0
/dev/mapper/clearos00-swap                                                       swap       swap defaults 0 0
/dev/sda                                                                                            / xfs                    defaults 0 0

ClearOS Change Home Directory

For another drive : /home directory to another drive partition sda1

Rename Home Directory then set permission and copy everything /home.old

mkdir /home

mount /dev/sda1    /home

nano /etc/fstab

/dev/sda /home ext3 defaults 0 0

[root@pdscatner ~]# cat /etc/fstab

#

/etc/fstab

Created by anaconda on Tue Nov 1 22:35:57 2016

#

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/clearos00-root                                         / xfs              defaults 0 0
UUID=dc38abda-7b93-4a6a-8cd0-05565ecd8993  /boot xfs     defaults 0 0
/dev/mapper/clearos00-swap                                       swap swap defaults 0 0
/dev/sda1                                                                               /home ext3 defaults 0 0

/dev/sda                                                                               /home none bind,rw 0 0

Command Line

[root@pdscatner home]# cat /etc/default/useradd

useradd defaults file

GROUP=63000
HOME=/eDATA/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes

==========================================================================

[root@kitmana ~]# fdisk -l

Disk /dev/sdb: 160.0 GB, 160041885696 bytes, 312581808 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: 0x000795cd

Device Boot Start End Blocks Id System
/dev/sdb1 2048 312581807 156289880 83 Linux

Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2):
No free sectors available

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition’s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

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

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

Format Hard Disk

[root@kitmana ~]# mkfs.ext3 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
9773056 inodes, 39072470 blocks
1953623 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
1193 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, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem ac

[root@kitmana ~]# mkdir /mnt/edata
[root@kitmana ~]# mount /dev/sdb1 /mnt/edata

[root@kitmana /]# cd /mnt/

[root@kitmana mnt]# ls -ll
total 4
drwxr-xr-x 3 root root 4096 Oct 6 23:40 edata

[root@kitmana ~]# cat /etc/fstab
#
# /etc/fstab

Created by anaconda on Tue Aug 30 19:02:09 2016

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/clearos-root / xfs defaults 0 0
UUID=9824322b-adb6-4a58-b263-57cbbe3cce12 /boot xfs defaults 0 0
/dev/mapper/clearos-swap swap swap defaults 0 0

[root@kitmana ~]# cat /etc/clearos/flexshare.conf
FlexsharePW=
FlexshareDirCustom=
FlexshareSecurityPermissions=on

Advertisements