Clone a file on btrfs in a split of a second
cp --reflink=always file.img clone_of_file.img
Before copying file
$ ls -s1
10485760 Centos53-2.img
Copying 10GB file
$ time cp --reflink=always Centos53-2.img Centos53-2_copy.img
real 0m0.001s
user 0m0.000s
sys 0m0.000s
After copying file
$ ls -s1
10485760 Centos53-2_copy.img
10485760 Centos53-2.img
Wednesday, January 22, 2014
Monday, January 20, 2014
Systemd default output or error output for all services and sockets
From man systemd and man systemd.unit(5)
StandardOutput=
StandardError=
Takes one of inherit, null, tty, journal, journal+console, syslog, syslog+console, kmsg, kmsg+console.
StandardOutput=
StandardError=
Wednesday, January 8, 2014
Arch Linux journalctl -f is very slow on btrfs filesystem
Check log size
journalctl --disk-usage
Check log for fragments
filefrag /var/log/journal/*/*
Defragment log
btrfs fi defrag -v -f -clzo /var/log/journal/*/*
Friday, November 29, 2013
LTFS Oracle/Centos/Redhat Linux
1. Dovnload "Single Drive Edition"/SDE LTFS driver and LTFS filesystem utilities from IBM use link Download driver or Google "Downloading LTFS"
2. Install FUSE support
yum install fuse-libs.x86_64 fuse.x86_64
3. Install LTFS File system
rpm -iv ltfs-*.rpm
4. Insert tape to LTO drive
5. mount LTFS ilesystem.
ltfs -o devname=/dev/IBMtape0 /LTFS/
Mounting a XEN/KVM/QEMU Image on ARCH Linux
Attach image
#Load nbd drivermodprobe nbd max_part=8
#Attach system image
qemu-nbd --connect=/dev/nbd0 System.img
#Mount Second partition
mount /dev/nbd0p2 /media
Release image
#Umount partition
umount /media/
#Remove image
qemu-nbd -d /dev/nbd0
#Remove driver
modprobe -r nbd Monday, July 8, 2013
Kernel-3.10 Nvidia 325.08 error
Found working patch from the nvidia developers forum.
https://devtalk.nvidia.com/cmd/default/download-
comment-attachment/58795/
How to apply patch in Gentoo: Just let epatch_user do the work :-)
All you need to do is create a nvidia-drivers dir in /etc/portage/patches/x11-drivers/
mkdir -p /etc/portage/patches/x11-drivers/nvidia-drivers
Download patch and copy it to newly created directory.
cp ~/Downloads/nvidia-drivers-linux-3.10.patch /etc/portage/patches/x11-drivers/nvidia-drivers/
Then just emerge nvidia-drivers or module-rebuild rebuild
PATCHES=/etc/portage/patches emerge -va nvidia-drivers
comment-attachment/58795/
How to apply patch in Gentoo: Just let epatch_user do the work :-)
All you need to do is create a nvidia-drivers dir in /etc/portage/patches/x11-drivers/
mkdir -p /etc/portage/patches/x11-drivers/nvidia-drivers
Download patch and copy it to newly created directory.
cp ~/Downloads/nvidia-drivers-linux-3.10.patch /etc/portage/patches/x11-drivers/nvidia-drivers/
Then just emerge nvidia-drivers or module-rebuild rebuild
PATCHES=/etc/portage/patches emerge -va nvidia-drivers
Wednesday, May 29, 2013
SAMBA Windows DC authentication on RedHat/Centos/Oracle Linux 6.x with SElinux enabled
Install winbind
yum install samba samba-winbind
Kerberos authentication
Create a backup of the krb5.conf file.
mv /etc/krb5.conf /etc/krb5.conf.org
vi /etc/krb5.conf
[logging]
default = FILE:/var/log/krb5.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmin.log
[libdefaults]
default_realm = CONTOSO.COM
dns_lookup_realm = false
dns_lookup_kdc = false
clock_skew = 300
ticket_lifetime = 24h
forwardable = yes
[realms]
CONTOSO.COM = {
kdc = DC.CONTOSO.COM
admin_server = DC.CONTOSO.COM
default_domain = CONTOSO.COM
}
Test kerberos DC connection
kinit administrator
SMB configuration
Create a backup of the smb.conf file.
mv /etc/samba/smb.conf /etc/samba/smb.conf.org
vi /etc/samba/smb.conf
[global]
workgroup = CONTOSO
realm = CONTOSO.COM
load printers = no
preferred master = no
local master = no
server string = fileserver
password server = 10.0.0.2
encrypt passwords = yes
security = ADS
netbios name = storage
client signing = Yes
dns proxy = No
wins server = 10.0.0.2
idmap uid = 10000-20000
idmap gid = 10000-20000
winbind separator = +
winbind enum users = Yes
winbind enum groups = Yes
winbind use default domain = Yes
auth methods = winbind
template shell = /bin/false
interfaces = lo eth0 127.0.0.1 10.0.0.10
bind interfaces only = yes
#
acl compatibility = auto
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=262144 SO_SNDBUF=262144
getwd cache = yes
#
#log level = 1
Add SAMBA server to Domain
kinit administrator
net ads join -U administrator
Start winbind
/etc/init.d/winbind start
/etc/init.d/winbind status
net rpc getsid
or
net rpc getsid net rpc getsid -S CONTOSO.COM -U administrator
Edit /etc/nsswitch.conf and add wins to do host lookups.
hosts: files dns wins
Check winbind get domain users/grups
wbinfo -u
wbinfo -g
Now tell PAM that samba requires authentication and account from winbind. Add the following lines to /etc/pam.d/samba
vi /etc/pam.d/samba
auth required /lib/security/pam_winbind.so
account required /lib/security/pam_winbind.so
Edit the /etc/nsswitch.conf file so it will look like this:
vi /etc/nsswitch.conf
passwd: compat winbind
group: compat winbind
shadow: compat
Create a share.
First we need to create a folder
mkdir –p /data/share
chmod 777 /data/share
Mount filesystem
vi /etc/fstab
/dev/sda3 /data/share ext4 rw,acl,user_xattr 0 0
mount /data/share
# Or remount existing partition
#mount -o remount /data/share
Enable SELinux share permission (relable)
chcon -R -t samba_share_t '/data/share'
Open the /etc/samba/smb.conf file and paste the following lines:
vi /etc/samba/smb.conf
[share]
comment = share
read only = no
path = /data/share
hide files = /lost+found/
valid users = @"CONTOSO+domain users"
admin users = @"CONTOSO+Domain Admins", root , administrator
write list = @"CONTOSO+Domain Admins" , root , administrator
read list = @"CONTOSO+domain users"
available = yes
browseable = yes
public = yes
writable = yes
acl check permissions = Yes
acl group control = Yes
acl map full control = Yes
#acl map full control = no
force unknown acl user = No
dos filemode = no
inherit permissions = yes
store dos attributes = no
map archive = No
map hidden = No
map system = No
map readonly = No
nt acl support = Yes
map acl inherit = yes
profile acls = No
inherit owner = No
inherit acls = yes
acl group control = yes
vfs objects = acl_xattr
Restart the Samba service via:
/etc/init.d/samba restart
Test the new share. Go to your Windows box and browse to the Linux box via \\share
Debuging
SAMBA reset ACL on file or directory
Test the new share. Go to your Windows box and browse to the Linux box via \\share
Debuging
SAMBA reset ACL on file or directory
setfacl -b FileOrFolder
SAMBA show ACL
getfacl FileOrFolder
SAMBA set ACL group
setfacl -m g:group:rw FileOrFolder
SAMBA set ACL user
setfacl -m u:user:r FileOrFolder
Subscribe to:
Posts (Atom)