Formating and mouting a new disk in Linux system.
In cPanel server we can take backups in /backup folder. For this we can purchase a new disk and formate and mount to your existing system. So the backup space will be added in the new disk.
Step 1: We need to find out the new disk attached to our system.
# fdisk -l
Disk /dev/sda: 1999.9 GB, 1999978364928 bytes
255 heads, 63 sectors/track, 243150 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 6387 51199155 83 Linux
/dev/sda3 6388 6897 4096575 83 Linux
/dev/sda4 6898 243150 1897702222+ 5 Extended
/dev/sda5 6898 10084 25599546 83 Linux
/dev/sda6 10085 10594 4096543+ 82 Linux swap / Solaris
/dev/sda7 10595 10849 2048256 83 Linux
/dev/sda8 10850 243150 1865957751 83 Linux
Disk /dev/sdb: 500 GB, 16139354112 bytes
/dev/sdb new partition will not have a partition.
Step 2:
Check new disk is already mounted
# df
If the new device is mounted you can unmounted this
# umount /dev/sdb
Step 3:
Create a new partition in" /dev/sdb"
A) # fdisk /dev/sdb
A console will be prompted and
Press "n" make new partition
Press Enter Button
Preess P button to create a new partition(primary)
Press 1
Press Enter Button
Press Enter Button for First and last cylinder. This will make the entire disk as a single partition.
Press t button To change the file system typr
Press Enter Button
Press L button to see all list
type 83 for Linux
Press Enter Button
press w Button
Press Enter Button
This will create a new partition on your /dev/sdb disk.
Step 4:
Formate the new partition
# mkfs.ext4 /dev/sdb1
Step 5:
Mount the partition.
# mkdir /backup
# mount /dev/sdb1 /backup
# vi /etc/fstab
/dev/sdb1 /backup ext4 defaults 1 2
Another Issue.
My test server which is created in VMWare EXSI server. After upgrading the disk space we need to mount the extra hard disk space on it.
root@puppetmaster:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 6.8G 6.0G 501M 93% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 1.1G 4.0K 1.1G 1% /dev
tmpfs 208M 512K 207M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1.1G 208K 1.1G 1% /run/shm
none 100M 0 100M 0% /run/user
overflow 100M 0 100M 0% /tmp
overflow 100M 0 100M 0% /tmp
root@puppetmaster:/# mkfs.ext3 /dev/sda2
root@puppetmaster:/# fdisk -l
Disk /dev/sda: 19.3 GB, 19327352832 bytes
255 heads, 63 sectors/track, 2349 cylinders, total 37748736 sectors
So I have created a new partition /dev/sda2
root@puppetmaster:/# fdisk /dev/sda
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 (1-4, default 2):
Using default value 2
First sector (14680064-37748735, default 14680064):
Using default value 14680064
Last sector, +sectors or +size{K,M,G} (14680064-37748735, default 37748735):
Using default value 37748735
Command (m for help): p
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00047f2a
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 14680063 7339008 83 Linux
/dev/sda2 14680064 37748735 11534336 83 Linux
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 83
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@puppetmaster:/#
while formating the new partition,
root@puppetmaster:/# mkfs.ext3 /dev/sda2
mke2fs 1.42.9 (4-Feb-2014)
mkfs.ext3: inode_size (128) * inodes_count (0) too big for a
filesystem with 0 blocks, specify higher inode_ratio (-i)
or lower inode count (-N).
So I have rebooted the server and executed the command.
The system is going down for reboot NOW!
root@puppetmaster:/#
ubuntu@puppetmaster:~$ sudo mkfs.ext3 /dev/sda2
mke2fs 1.42.9 (4-Feb-2014)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621440 blocks
131072 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 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
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
ubuntu@puppetmaster:~$
ubuntu@puppetmaster:~$ sudo mount /dev/sda2 /backup
ubuntu@puppetmaster:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 6.8G 6.0G 506M 93% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 1.1G 12K 1.1G 1% /dev
tmpfs 208M 500K 207M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1.1G 208K 1.1G 1% /run/shm
none 100M 0 100M 0% /run/user
/dev/sda2 9.8G 23M 9.2G 1% /backup
In cPanel server we can take backups in /backup folder. For this we can purchase a new disk and formate and mount to your existing system. So the backup space will be added in the new disk.
Step 1: We need to find out the new disk attached to our system.
# fdisk -l
Disk /dev/sda: 1999.9 GB, 1999978364928 bytes
255 heads, 63 sectors/track, 243150 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 6387 51199155 83 Linux
/dev/sda3 6388 6897 4096575 83 Linux
/dev/sda4 6898 243150 1897702222+ 5 Extended
/dev/sda5 6898 10084 25599546 83 Linux
/dev/sda6 10085 10594 4096543+ 82 Linux swap / Solaris
/dev/sda7 10595 10849 2048256 83 Linux
/dev/sda8 10850 243150 1865957751 83 Linux
Disk /dev/sdb: 500 GB, 16139354112 bytes
/dev/sdb new partition will not have a partition.
Step 2:
Check new disk is already mounted
# df
If the new device is mounted you can unmounted this
# umount /dev/sdb
Step 3:
Create a new partition in" /dev/sdb"
A) # fdisk /dev/sdb
A console will be prompted and
Press "n" make new partition
Press Enter Button
Preess P button to create a new partition(primary)
Press 1
Press Enter Button
Press Enter Button for First and last cylinder. This will make the entire disk as a single partition.
Press t button To change the file system typr
Press Enter Button
Press L button to see all list
type 83 for Linux
Press Enter Button
press w Button
Press Enter Button
This will create a new partition on your /dev/sdb disk.
Step 4:
Formate the new partition
# mkfs.ext4 /dev/sdb1
Step 5:
Mount the partition.
# mkdir /backup
# mount /dev/sdb1 /backup
# vi /etc/fstab
/dev/sdb1 /backup ext4 defaults 1 2
Another Issue.
My test server which is created in VMWare EXSI server. After upgrading the disk space we need to mount the extra hard disk space on it.
root@puppetmaster:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 6.8G 6.0G 501M 93% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 1.1G 4.0K 1.1G 1% /dev
tmpfs 208M 512K 207M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1.1G 208K 1.1G 1% /run/shm
none 100M 0 100M 0% /run/user
overflow 100M 0 100M 0% /tmp
overflow 100M 0 100M 0% /tmp
root@puppetmaster:/# mkfs.ext3 /dev/sda2
root@puppetmaster:/# fdisk -l
Disk /dev/sda: 19.3 GB, 19327352832 bytes
255 heads, 63 sectors/track, 2349 cylinders, total 37748736 sectors
So I have created a new partition /dev/sda2
root@puppetmaster:/# fdisk /dev/sda
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 (1-4, default 2):
Using default value 2
First sector (14680064-37748735, default 14680064):
Using default value 14680064
Last sector, +sectors or +size{K,M,G} (14680064-37748735, default 37748735):
Using default value 37748735
Command (m for help): p
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00047f2a
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 14680063 7339008 83 Linux
/dev/sda2 14680064 37748735 11534336 83 Linux
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 83
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@puppetmaster:/#
while formating the new partition,
root@puppetmaster:/# mkfs.ext3 /dev/sda2
mke2fs 1.42.9 (4-Feb-2014)
mkfs.ext3: inode_size (128) * inodes_count (0) too big for a
filesystem with 0 blocks, specify higher inode_ratio (-i)
or lower inode count (-N).
So I have rebooted the server and executed the command.
The system is going down for reboot NOW!
root@puppetmaster:/#
ubuntu@puppetmaster:~$ sudo mkfs.ext3 /dev/sda2
mke2fs 1.42.9 (4-Feb-2014)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621440 blocks
131072 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 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
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
ubuntu@puppetmaster:~$
ubuntu@puppetmaster:~$ sudo mount /dev/sda2 /backup
ubuntu@puppetmaster:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 6.8G 6.0G 506M 93% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 1.1G 12K 1.1G 1% /dev
tmpfs 208M 500K 207M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1.1G 208K 1.1G 1% /run/shm
none 100M 0 100M 0% /run/user
/dev/sda2 9.8G 23M 9.2G 1% /backup
No comments:
Post a Comment