Sunday, January 14, 2024

windows ntfs and Extrnal HDDs partitions mount in Centos 7 Linux

first download ntfs-3g driver for Linux source code from 

"https://www.tuxera.com/company/open-source/".

 now get root prompt, extract file get inside it and run following commands :-

# cd ntfs-3g-progs

# chmod +x configure

# ./configure

# make

# make install

# mkdir /mnt/wind

# mkdir /mnt/wine

 now open /etc/fstab as 

# gedit /etc/fstab & ( ampersand for background mode )

inside fstab file :-

# device name - mount directory - file system type - read/write mode 0 0 

/dev/sdb1         /mnt/wind               ntfs-3g                 defaults 0 0
/dev/sdb2         /mnt/wine               ntfs-3g                 defaults 0 0 


to get /dev/sdx name goto other locations in left pane of nautilus. You can see /dev/sdx numbers of drives. Those are set in above lines in fstab. you may set mode to "defaults" or "rw" for read and write both. Same thing you can do with other file systems of any OS.  Now run following comands :-

# mount -a

this command will mount all filesystems as mentioned. to un mount all file systems except systems defined do this :-

# umount -a

to mount external HDD drives :-

# mount -t ntfs-3g /dev/sdx /mnt/directory 

where x in sdx is filesystem number. You may get it by clicking into name of external HDD in left pane of nautilus. This will show a message box having text that "dev/sdx" can not be mounted or something like that. But there is name of  device name something like this  : /dev/sdd1. Here /dev/sdd1 is name of filesystem. replace it with /dev/sdx in above command. You can write down thes commands in a shell script and run it as root user as :-

mount -t ntfs-3g /dev/sdd1 /mnt/ext4tb-1
mount -t ntfs-3g /dev/sdd2 /mnt/ext4tb-2
mount -t ntfs-3g /dev/sdd3 /mnt/ext4tb-3
mount -t ntfs-3g /dev/sdd4 /mnt/ext4tb-4

save this as mountntfs.sh. set its permission to executable as (requires only when this file is created ):-

# chmod +x mountntfs.sh

and run as :-

# ./mountntfs.sh

this will mount all filesystems "/dev/sdx" to /mnt/ext4tb-x"

if you "umount -a" all filesystems except of "UUIDs" will be un-mouned. to remount you need to fire all commands for filesystems written in /etc/fstab and mountntfs.sh as mentioned above. Or you can use command "mount -a" to mount all filesystems in /etc/fstab file.

dual boot CentOS 7 & Kali linux 2023

 Let we have two HDDs 1st for Centos 7 and 2nd of Kali linux.

Boot in Centos and go to root prompt.

# cd /opt

# grub2-mkconfig -o grub.cfg

# cp grub.cfg /boot/grub2/grub.cfg.new

# cd /boot/grub2/

# mv grub.cfg grub.cfg.original.backup 

# mv grub.cfg.new grub.cfg

# gedit grub.cfg

search for timeout=5 and change it to your timeout at boot menu of centos.

As I changed it to timeout=60 ( for 60 seconds ).

Again you can change title ( menuentry ) for kali linux, because it is set as Debian...  

you may change it to  'Kali Linux 2023'.

# reboot 

and you will have dual boot  of CentOS 7 and Kali.

If you want to change default boot OS high lighting in boot menu, open file as :-

# gedit /boot/grub2/grubenv & ( in background mode of gedit )

change to for CentoOS as here :

saved_entry=CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)

or  for kali linux :-

saved_entry=Kali Linux 2023 (on /dev/sda3)

These are obtained from line in "grub.cfg" as here :-

menuentry 'Kali Linux 2023 (on /dev/sda3)'

copy text between both single quotes, of course without quotes and paste in file "grubenv" without single quotes. And that will be the default boot option in boot menu. There is entry like :-

# GRUB Environment Block
saved_entry=CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)

or 

 saved_entry=Kali Linux 2023 (on /dev/sda3)

Change it as your wish.

If there is any mismatch between menyentry text and saved_entry text and even you add double quots or space in last or before then default boot option will be high lighted.