Showing posts with label fstab. Show all posts
Showing posts with label fstab. Show all posts

Sunday, August 22, 2021

howto mont file NTFS in windows to Ubuntu 20.04.3 LTS

 I use multi OS in my notebook. I want to mount file NTFS from windows to Ubuntu.

1. Create file

sudo mkdir -p /media/user/drive_c

sudo mkdir -p /media/user/drive_d

sudo chown user:guser /media/user/* -R

2. check path location NTFS

sudo fdisk -l

Device              Start        End   Sectors   Size Type

/dev/nvme0n1p1       2048     206847    204800   100M EFI System

/dev/nvme0n1p2     206848     239615     32768    16M Microsoft reserved

/dev/nvme0n1p3     239616  168011775 167772160    80G Microsoft basic data

/dev/nvme0n1p4  168011776  285198335 117186560  55.9G Linux filesystem

/dev/nvme0n1p5  762908672  967706623 204797952  97.7G Microsoft basic data

/dev/nvme0n1p6  967708672  968757247   1048576   512M Windows recovery environme

/dev/nvme0n1p7  968757248  998117375  29360128    14G Windows recovery environme

/dev/nvme0n1p8  998117376 1000214527   2097152     1G Windows recovery environme

/dev/nvme0n1p9  285198336  300822527  15624192   7.5G Linux swap

/dev/nvme0n1p10 300822528  762908671 462086144 220.3G Linux filesystem

Partition table entries are not in disk order.

3. add command to file /etc/fstab
# mount NTFS drive
/dev/nvme0n1p3 /media/user/drive_c ntfs defaults,uid=1000,gid=1000,rw 0 0
/dev/nvme0n1p5 /media/user/drive_d ntfs defaults,uid=1000,gid=1000,rw 0 0

4. run command
sudo mount -a
or restart notebook.


Wednesday, January 1, 2014

mont /etc/fstab on ubuntu 13.04

Add scrip mount network For ubuntu 13.04

-----------------/etc/fstab-----------------
//192.168.x.xx/Market /media/Market    cifs user=user01,passwd=user001,uid=1000,gid=1000
--------------////------------------------------

------------------------------------------------------------
ใช้คำสั่ง dmesg | tail เพื่อตรวจสอบหาปัญหาทำไมไม่สามารถ mount path share file windows 2000 with CentOs 8 จะได้ Error: No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.

การทำ Mount Drive ในกรณีที่เครื่อง Windows 2000 SMBv1 แต่เครื่อง Linux Server รุ่นใหม่(SMBv2,3) ไม่ Support SMBv1 ซึ่งเป็น Version เก่า

Allowed SMB protocol version values are:
  • 1.0 - The classic CIFS/SMBv1 protocol. This was the default.
  • 2.0 - The SMBv2.002 protocol. This was initially introduced in Windows Vista Service Pack 1, and Windows Server 2008. Note that the initial release version of Windows Vista spoke a slightly different dialect (2.000) that is not supported.
  • 2.1 - The SMBv2.1 protocol that was introduced in Microsoft Windows 7 and Windows Server 2008R2.
  • 3.0 - The SMBv3.0 protocol that was introduced in Microsoft Windows 8 and Windows Server 2012.

แก้ไข /etc/fstab

//172.16.0.xx/Sharefile /mnt/sharefile cifs user,uid=1000,rw,suid,username=user03,password=user003,iocharset=utf8,vers=1.0 0 0

เสร็จแล้วรันคำสั่ง
mount -a
ยกเลิกการ mount
umount /mnt/sharefie

-------------------------------------------------------------------------

การสร้างสคริป Mount Drive แบบอัตโนมัติ

vim /root/mapdrive.sh
-----------------------Start Script---------------------------------
mount -o username=user,password=xxxx,uid=1000,gid=1000 //192.168.1.10/public/share /media/support/share

------------------------End script----------------------------------

Run Script

sudo vim /etc/rc.local --> แอดสคริปให้ทำงานทุกคร้้งตอนเปิดเครื่อง
---------------------------------
# By default this script does nothing.
/root/mapdrive.sh
----------------------------------------

Monday, April 8, 2013

Scrip Map network drive on ubuntu


For ubuntu 10.xx - 12.04
//192.168.4.xx/market  /media/market  cifs    username=center,password=xxx001,iocharset=utf8,codepage=unicode,unicode       0       0

For ubuntu 12.04 Kernel 3.6.0
install packet smbfs
#aptitude install smbfs
edit #vim /etc/fstab
.
.
//192.168.4.xx/market  /media/market  cifs    username=center,password=xx001,iocharset=utf8,uid=1000,gid=1000       0       0

**uid=1000 check on /etc/passwd
**gid=1000 check on /etc/group

command map

#mount -o username=mxx,password=mxxx //192.168.xx.25/share folder /media/mail

Create file Credentails

1. Create Folder on Client
#mkdir /home/user/Sharefile

2. create file passwd credentail

#echo “username=samba_username” > /home/user/Sharefile/.smbcredentials
#echo “password=password_username” > /home/user/Sharefile/.smbcredentials
#chmod 600 /home/user/Sharefile/.smbcredentials

3. Edit file /etc/fstab
add new line

#//192.168.0.xx/downloads        /home/user/Sharefile       cifs    uid=1000,gid=1000,credentials=/home/user/Sharefile/.smbcredentials,defaults        0       0

4.Run mapdrive
#mount //192.168.0.xx/downloads
or
#mount -a

umount
#umount Sharefile


Ref.
techsuii.com