If you try to unmount a partition and get a message like this:
# umount /media/usbdisk/ umount: /media/usbdisk: device is busy
use the lsof command to find out what programs are using what files:
# lsof /media/usbdisk/ COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME bash 6925 root cwd DIR 8,17 4096 1 /media/usbdisk/ xmms 6979 root cwd DIR 8,17 4096 1 /media/usbdisk/
This shows that the programs bash and xmms are using the device. For an even clearer picture, use the device name rather than the mountpoint:
# lsof /dev/sdb1 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME bash 6925 root cwd DIR 8,17 4096 1 /media/usbdisk xmms 6979 root cwd DIR 8,17 4096 1 /media/usbdisk xmms 6979 root 8r REG 8,17 2713101 377 /media/usbdisk/a.mp3
You either can wait until those processes exit or terminate them manually.
To search a list of RPM files for a particular file, execute the following command:
$ ls RPMS-TO-SEARCH | \ xargs rpm --query --filesbypkg --package | \ grep FILE-TO-SEARCH-FOR
Replace RPMS-TO-SEARCH with the names of the RPM files to search, and replace FILE-TO-SEARCH-FOR with the name of the file to search for. The --filesbypkg option tells the rpm command to output the name of the package as well as the name of the file.
If you need to transfer an entire filesystem from one machine to another, for example, when you get a new computer, do the following steps.
1) Boot both PCs with any Linux live CD (for example, Knoppix), and make sure they can access each other via the network.
2) On the source machine, mount the partition containing the filesystem to be copied, and start the transfer using netcat and tar:
cd /mnt/sda1 tar -czpsf - . | pv -b | nc -l 3333
3) On the destination machine, mount the partition to receive the filesystem, and start the process:
cd /mnt/sda1 nc 192.168.10.101 3333 | pv -b | tar -xzpsf -
The nc (netcat) command is used for any kind of TCP connections between two hosts. The pv (progress viewer) command is used to display the progress of the transfer. tar is used to archive the files on the source machine and un-archive them on the destination.
- The Tiny Internet Project, Part I
- SUSECON 2016: Where Technology Reigns Supreme
- Bitcoin on Amazon! Sort of...
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Android Browser Security--What You Haven't Been Told
- Free Today: September Issue of Linux Journal (Retail value: $5.99)
- October 2016 Video Preview
- Securing the Programmer
- Machine Learning with Python
Pick up any e-commerce web or mobile app today, and you’ll be holding a mashup of interconnected applications and services from a variety of different providers. For instance, when you connect to Amazon’s e-commerce app, cookies, tags and pixels that are monitored by solutions like Exact Target, BazaarVoice, Bing, Shopzilla, Liveramp and Google Tag Manager track every action you take. You’re presented with special offers and coupons based on your viewing and buying patterns. If you find something you want for your birthday, a third party manages your wish list, which you can share through multiple social- media outlets or email to a friend. When you select something to buy, you find yourself presented with similar items as kind suggestions. And when you finally check out, you’re offered the ability to pay with promo codes, gifts cards, PayPal or a variety of credit cards.Get the Guide