Add a New Disk in Linux- Partition and Format Rumi, May 9, 2018 Partition the new disk using fdisk command Following command will list all detected hard disks: # fdisk -l | grep '^Disk' Output: Disk /dev/sda: 251.0 GB, 251000193024 bytes Disk /dev/sdb: 251.0 GB, 251000193024 bytes A device name refers to the entire hard disk. For more information see Linux partition naming convention and IDE drive mappings. To partition the disk – /dev/sdb, enter: # fdisk /dev/sdb The basic fdisk commands you need are: m – print help p – print the partition table n – create a new partition d – delete a partition q – quit without saving changes w – write the new partition table and exit Format the new disk using mkfs.ext3 command To format Linux partitions using ext2fs on the new disk: # mkfs.ext3 /dev/sdb1 Or # mkfs.ext4 /dev/sdb1 Mount the new disk using mount command First create a mount point /disk1 and use mount command to mount /dev/sdb1, enter: # mkdir /disk1 # mount /dev/sdb1 /disk1 # df -H Update /etc/fstab file Open /etc/fstab file, enter: # vi /etc/fstab Append as follows: /dev/sdb1 /disk1 ext3 defaults 1 2 or /dev/sdb1 /disk1 ext4 defaults 1 2 Save and close the file. Label the partition You can label the partition using e2label. For example, if you want to label the new partition /backup, enter # e2label /dev/sdb1 /backup You can use label name instead of partition name to mount disk using /etc/fstab: LABEL=/backup /disk1 ext3 defaults 1 2 Related Administrations Configurations (Linux) FdiskMkfsMount
Linux CHMOD Change user & group ownership June 21, 2008January 7, 2011 Learn how to change the owner and group ownership of files and directories with the chown and chgrp commands. Caution: you need to do this whiled logged in as 'root' user. In order to set the ownership of a directory and all the files in that directory, you'll need the… Read More
Disable gpgcheck while running updates January 12, 2024 Problem Statement: # su -c ‘yum install *.rpm’ which produced a long list of packages and depchecks, apparently successfully, but then gave: Install 50 Package(s) Total size: 436 M Installed size: 436 M Is this ok [y/N]: y Downloading Packages: Package libobasis3.3-en-US-base-3.3.0-6.x86_64.rpm is not signed [dave at davehost RPMS]$ Resolution:… Read More
Remove Old Kernels of Debian/Ubuntu April 1, 2022 To find out the current version of Linux kernel running on your system, use the following command. $ uname -sr Linux 4.12.0-041200-generic To list all installed kernels on your system, issue this command. $ dpkg -l | grep linux-image | awk ‘{print$2}’ linux-image-4.12.0-041200-generic linux-image-4.8.0-22-generic linux-image-extra-4.8.0-22-generic linux-image-generic Remove Old Unused Kernels… Read More