Linux fsck.ext3 says “Device or resource busy” although I did not mount the disk

fscklinuxmountUbuntuvmware-server

Edit This old question is maybe not worth reading, because the soulution is simple. I used checkdisk on the whole drive instead of on a partition of that drive, that's all. matnagel /Edit

I am running an ubuntu 8.04 server instance with a 8GB virtual disk on vmware 1.0.9.

For disk maintenance I made a copy of the virtual disk (by making a copy of the 2 vmdk files of sda on the stopped vm on the host) and added it to the original vm. Now this vm has it's original virtual disk sda plus a 1:1 copy (sdd). There are 2 additional disk sdb and sdc which I ignore.)

I would expect sdb not to be mounted when I start the vm. So I try tp do a ext2 fsck on sdd from the running vm, but it reports fsck reported that sdb was mounted.

$ sudo fsck.ext3 -b 8193 /dev/sdd
e2fsck 1.40.8 (13-Mar-2008)
fsck.ext3: Device or resource busy while trying to open /dev/sdd
Filesystem mounted or opened exclusively by another program?

The "mount" command does not tell me sdd is mounted:

$ sudo mount
/dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sdc1 on /mnt/r1 type ext3 (rw,relatime,errors=remount-ro)
/dev/sdb1 on /mnt/k1 type ext3 (rw,relatime,errors=remount-ro)
securityfs on /sys/kernel/security type securityfs (rw)

When I ignore the warning and continue the fsck, it reported many errors.

How do I get this under control? Is there a better way to figure out if sdd is mounted? Or how is it "busy? How to unmount it then? How to prevent ubuntu from automatically mounting. Or is there something else I am missing? Also from /var/log/syslog I cannot see it is mounted, this is the last part of the startup sequence:

kernel: [   14.229494] ACPI: Power Button (FF) [PWRF]
kernel: [   14.230326] ACPI: AC Adapter [ACAD] (on-line)
kernel: [   14.460136] input: PC Speaker as /devices/platform/pcspkr/input/input3
kernel: [   14.639366] udev: renamed network interface eth0 to eth1
kernel: [   14.670187] eth1: link up
kernel: [   16.329607] input: ImPS/2 Generic Wheel Mouse as /devices/platform/i8042/serio1/
kernel: [   16.367540] parport_pc 00:08: reported by Plug and Play ACPI
kernel: [   16.367670] parport0: PC-style at 0x378, irq 7 [PCSPP,TRISTATE]
kernel: [   19.425637] NET: Registered protocol family 10
kernel: [   19.437550] lo: Disabled Privacy Extensions
kernel: [   24.328857] loop: module loaded
kernel: [   24.449293] lp0: using parport0 (interrupt-driven).
kernel: [   26.075499] EXT3 FS on sda1, internal journal
kernel: [   28.380299] kjournald starting.  Commit interval 5 seconds
kernel: [   28.381706] EXT3 FS on sdc1, internal journal
kernel: [   28.381747] EXT3-fs: mounted filesystem with ordered data mode.
kernel: [   28.444867] kjournald starting.  Commit interval 5 seconds
kernel: [   28.445436] EXT3 FS on sdb1, internal journal
kernel: [   28.445444] EXT3-fs: mounted filesystem with ordered data mode.
kernel: [   31.309766] eth1: no IPv6 routers present
kernel: [   35.054268] ip_tables: (C) 2000-2006 Netfilter Core Team
mysqld_safe[4367]: started
mysqld[4370]: 100124 14:40:21  InnoDB: Started; log sequence number 0 10130914
mysqld[4370]: 100124 14:40:21 [Note] /usr/sbin/mysqld: ready for connections.
mysqld[4370]: Version: '5.0.51a-3ubuntu5.4'  socket: '/var/run/mysqld/mysqld.sock'  port: 3
/etc/mysql/debian-start[4417]: Upgrading MySQL tables if necessary.
/etc/mysql/debian-start[4422]: Looking for 'mysql' in: /usr/bin/mysql
/etc/mysql/debian-start[4422]: Looking for 'mysqlcheck' in: /usr/bin/mysqlcheck
/etc/mysql/debian-start[4422]: This installation of MySQL is already upgraded to 5.0.51a, u
/etc/mysql/debian-start[4436]: Checking for insecure root accounts.
/etc/mysql/debian-start[4444]: Checking for crashed MySQL tables.

Best Answer

Yes you are right in that you are running fsck on the whole drive instead of the partition. To check if the filesystem is mounted you can check /etc/mtab and also grep the output of lsof to make sure no process has your partition open.