X-Received: by 10.66.82.98 with SMTP id h2mr3043283pay.3.1358891990737; Tue, 22 Jan 2013 13:59:50 -0800 (PST) MIME-Version: 1.0 Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!f6no9423853pbd.1!news-out.google.com!6ni12228pbd.1!nntp.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.posted.palinacquisition!news.posted.palinacquisition.POSTED!not-for-mail NNTP-Posting-Date: Tue, 22 Jan 2013 15:59:43 -0600 Newsgroups: comp.os.linux.development.system,comp.unix.programmer From: Ben Scott Subject: Moving data on a raw device with a mounted partition Followup-To: comp.os.linux.development.system User-Agent: slrn/pre1.0.0-18 (Linux) Message-ID: Date: Tue, 22 Jan 2013 15:59:43 -0600 Lines: 15 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 209.20.133.136 X-Trace: sv3-RhRXhdJSTGm7uSfHGy3tZmSJDYEIoL8AyqORA6dmPljE111Ud78D5rGr42TPI0WemtzXlROetbg+Tvm!ooJ0Eky7XHp+9Ksa7LF/rQ5eRD7yxZ3ibUR380kn1c5cChmY+CJgu8zc1u/AYFs06NGcZ1KKzHgT!kW96ianHqeUgcoiVkTVeU8kM7iTimRQwlvTZ X-Complaints-To: abuse@iinet.com X-DMCA-Complaints-To: abuse@iinet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1745 Xref: csiph.com comp.os.linux.development.system:488 comp.unix.programmer:4152 I need to be able to move data around a disk that has mounted partitions on Linux. I am not touching data inside the mounted partitions or the MBR, only the free space around it or unmounted partitions. So, for example, I would need access to "/dev/sdb" while "/dev/sdb1" is mounted. Currently I am using libparted functions but the move is giving me corruption when the disk is busy. Would the system call open(pathname, flags) work here? If I use open() are there any major gotchas I should be aware of? Also, what flags would be a good idea? I'll need O_LARGEFILE and O_NOATIME but I am wondering about O_DIRECT for example. Thank you.